Was führt zu unterschiedlichen Suchergebnissen für dieselbe elastische Suchanfrage auf zwei Knoten

Ich habe eine elastische Suche mit zwei Knoten eingerichtet, bei der dieselbe Suchanfrage auf dem einen Knoten zu anderen Ergebnissen als auf dem anderen führt, und ich möchte herausfinden, warum dies der Fall ist. Einzelheiten

Die gleichen Dokumente (gleicher Inhalt und gleiche ID) weisen für beide Knoten eine unterschiedliche Punktzahl auf, was zu einer unterschiedlichen Sortierreihenfolge führt.s ist reproduzierbar: Ich kann den gesamten Index löschen und aus der Datenbank neu erstellen, und trotzdem sind die Ergebnisse unterschiedlicZwei Knoten werden eingebettet in einen Java-Krieg eingesetzt. Bei jeder Bereitstellung wird der Index aus der Datenbank neu erstellt.Ursprünglich, wenn das Problem gefunden wurde, wurde für die gleiche Abfrage eine andere hits.total-Abfrage auf den beiden Knoten erstellt. Sie sind die gleichen, nachdem ich den Index gelöscht und neu erstellt habe.Meine Problemumgehung für den Moment ist die Verwendung von preferences = _local wie vorgeschlagenHie. Ich konnte bisher keine interessanten Fehler in den Protokollen finden.

_cluster / state:

{
    "cluster_name": "elasticsearch.abc",
    "version": 330,
    "master_node": "HexGKOoHSxqRaMmwduCVIA",
    "blocks": {},
    "nodes": {
        "rUZDrUfMR1-RWcy4t0YQNw": {
            "name": "Owl",
            "transport_address": "inet[/10.123.123.123:9303]",
            "attributes": {}
        },
        "HexGKOoHSxqRaMmwduCVIA": {
            "name": "Bloodlust II",
            "transport_address": "inet[/10.123.123.124:9303]",
            "attributes": {}
        }
    },
    "metadata": {
        "templates": {},
        "indices": {
            "abc": {
                "state": "open",
                "settings": {
                    "index": {
                        "creation_date": "1432297566361",
                        "uuid": "LKx6Ro9CRXq6JZ9a29jWeA",
                        "analysis": {
                            "filter": {
                                "substring": {
                                    "type": "nGram",
                                    "min_gram": "1",
                                    "max_gram": "50"
                                }
                            },
                            "analyzer": {
                                "str_index_analyzer": {
                                    "filter": [
                                        "lowercase",
                                        "substring"
                                    ],
                                    "tokenizer": "keyword"
                                },
                                "str_search_analyzer": {
                                    "filter": [
                                        "lowercase"
                                    ],
                                    "tokenizer": "keyword"
                                }
                            }
                        },
                        "number_of_replicas": "1",
                        "number_of_shards": "5",
                        "version": {
                            "created": "1050099"
                        }
                    }
                },
                "mappings": {
                    "some_mapping": {
                        ...
                    }
                    ...
                },
                "aliases": []
            }
        }
    },
    "routing_table": {
        "indices": {
            "abc": {
                "shards": {
                    "0": [
                        {
                            "state": "STARTED",
                            "primary": true,
                            "node": "HexGKOoHSxqRaMmwduCVIA",
                            "relocating_node": null,
                            "shard": 0,
                            "index": "abc"
                        },
                        {
                            "s,tate": "STARTED",
                            "primary": false,
                            "node": "rUZDrUfMR1-RWcy4t0YQNw",
                            "relocating_node": null,
                            "shard": 0,
                            "index": "abc"
                        }
                    ],
                    "1": [
                        {
                            "state": "STARTED",
                            "primary": false,
                            "node": "HexGKOoHSxqRaMmwduCVIA",
                            "relocating_node": null,
                            "shard": 1,
                            "index": "abc"
                        },
                        {
                            "state": "STARTED",
                            "primary": true,
                            "node": "rUZDrUfMR1-RWcy4t0YQNw",
                            "relocating_node": null,
                            "shard": 1,
                            "index": "abc"
                        }
                    ],
                    "2": [
                        {
                            "state": "STARTED",
                            "primary": true,
                            "node": "HexGKOoHSxqRaMmwduCVIA",
                            "relocating_node": null,
                            "shard": 2,
                            "index": "abc"
                        },
                        {
                            "state": "STARTED",
                            "primary": false,
                            "node": "rUZDrUfMR1-RWcy4t0YQNw",
                            "relocating_node": null,
                            "shard": 2,
                            "index": "abc"
                        }
                    ],
                    "3": [
                        {
                            "state": "STARTED",
                            "primary": false,
                            "node": "HexGKOoHSxqRaMmwduCVIA",
                            "relocating_node": null,
                            "shard": 3,
                            "index": "abc"
                        },
                        {
                            "state": "STARTED",
                            "primary": true,
                            "node": "rUZDrUfMR1-RWcy4t0YQNw",
                            "relocating_node": null,
                            "shard": 3,
                            "index": "abc"
                        }
                    ],
                    "4": [
                        {
                            "state": "STARTED",
                            "primary": true,
                            "node": "HexGKOoHSxqRaMmwduCVIA",
                            "relocating_node": null,
                            "shard": 4,
                            "index": "abc"
                        },
                        {
                            "state": "STARTED",
                            "primary": false,
                            "node": "rUZDrUfMR1-RWcy4t0YQNw",
                            "relocating_node": null,
                            "shard": 4,
                            "index": "abc"
                        }
                    ]
                }
            }
        }
    },
    "routing_nodes": {
        "unassigned": [],
        "nodes": {
            "HexGKOoHSxqRaMmwduCVIA": [
                {
                    "state": "STARTED",
                    "primary": true,
                    "node": "HexGKOoHSxqRaMmwduCVIA",
                    "relocating_node": null,
                    "shard": 4,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": true,
                    "node": "HexGKOoHSxqRaMmwduCVIA",
                    "relocating_node": null,
                    "shard": 0,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": false,
                    "node": "HexGKOoHSxqRaMmwduCVIA",
                    "relocating_node": null,
                    "shard": 3,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": false,
                    "node": "HexGKOoHSxqRaMmwduCVIA",
                    "relocating_node": null,
                    "shard": 1,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": true,
                    "node": "HexGKOoHSxqRaMmwduCVIA",
                    "relocating_node": null,
                    "shard": 2,
                    "index": "abc"
                }
            ],
            "rUZDrUfMR1-RWcy4t0YQNw": [
                {
                    "state": "STARTED",
                    "primary": false,
                    "node": "rUZDrUfMR1-RWcy4t0YQNw",
                    "relocating_node": null,
                    "shard": 4,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": false,
                    "node": "rUZDrUfMR1-RWcy4t0YQNw",
                    "relocating_node": null,
                    "shard": 0,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": true,
                    "node": "rUZDrUfMR1-RWcy4t0YQNw",
                    "relocating_node": null,
                    "shard": 3,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": true,
                    "node": "rUZDrUfMR1-RWcy4t0YQNw",
                    "relocating_node": null,
                    "shard": 1,
                    "index": "abc"
                },
                {
                    "state": "STARTED",
                    "primary": false,
                    "node": "rUZDrUfMR1-RWcy4t0YQNw",
                    "relocating_node": null,
                    "shard": 2,
                    "index": "abc"
                }
            ]
        }
    },
    "allocations": []
}

_cluster / health

{
    "cluster_name": "elasticsearch.abc",
    "status": "green",
    "timed_out": false,
    "number_of_nodes": 2,
    "number_of_data_nodes": 2,
    "active_primary_shards": 5,
    "active_shards": 10,
    "relocating_shards": 0,
    "initializing_shards": 0,
    "unassigned_shards": 0,
    "number_of_pending_tasks": 0
}

_cluster / stats

{
    "timestamp": 1432312770877,
    "cluster_name": "elasticsearch.abc",
    "status": "green",
    "indices": {
        "count": 1,
        "shards": {
            "total": 10,
            "primaries": 5,
            "replication": 1,
            "index": {
                "shards": {
                    "min": 10,
                    "max": 10,
                    "avg": 10
                },
                "primaries": {
                    "min": 5,
                    "max": 5,
                    "avg": 5
                },
                "replication": {
                    "min": 1,
                    "max": 1,
                    "avg": 1
                }
            }
        },
        "docs": {
            "count": 19965,
            "deleted": 4
        },
        "store": {
            "size_in_bytes": 399318082,
            "throttle_time_in_millis": 0
        },
        "fielddata": {
            "memory_size_in_bytes": 60772,
            "evictions": 0
        },
        "filter_cache": {
            "memory_size_in_bytes": 15284,
            "evictions": 0
        },
        "id_cache": {
            "memory_size_in_bytes": 0
        },
        "completion": {
            "size_in_bytes": 0
        },
        "segments": {
            "count": 68,
            "memory_in_bytes": 10079288,
            "index_writer_memory_in_bytes": 0,
            "index_writer_max_memory_in_bytes": 5120000,
            "version_map_memory_in_bytes": 0,
            "fixed_bit_set_memory_in_bytes": 0
        },
        "percolate": {
            "total": 0,
            "time_in_millis": 0,
            "current": 0,
            "memory_size_in_bytes": -1,
            "memory_size": "-1b",
            "queries": 0
        }
    },
    "nodes": {
        "count": {
            "total": 2,
            "master_only": 0,
            "data_only": 0,
            "master_data": 2,
            "client": 0
        },
        "versions": [
            "1.5.0"
        ],
        "os": {
            "available_processors": 8,
            "mem": {
                "total_in_bytes": 0
            },
            "cpu": []
        },
        "process": {
            "cpu": {
                "percent": 0
            },
            "open_file_descriptors": {
                "min": 649,
                "max": 654,
                "avg": 651
            }
        },
        "jvm": {
            "max_uptime_in_millis": 2718272183,
            "versions": [
                {
                    "version": "1.7.0_40",
                    "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
                    "vm_version": "24.0-b56",
                    "vm_vendor": "Oracle Corporation",
                    "count": 2
                }
            ],
            "mem": {
                "heap_used_in_bytes": 2665186528,
                "heap_max_in_bytes": 4060086272
            },
            "threads": 670
        },
        "fs": {
            "total_in_bytes": 631353901056,
            "free_in_bytes": 209591468032,
            "available_in_bytes": 209591468032
        },
        "plugins": []
    }
}

Beispielabfrage:

/_search?from=22&size=1
{
  "query": {
    "bool": {
      "should": [{
        "match": {
          "address.city": {
            "query": "Bremen",
            "boost": 2
          }
        }
      }],
      "must": [{
        "match": {
          "type": "L"
        }
      }]
    }
  }
}

Antwort auf die erste Anfrage

{
  "took": 30,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 19543,
    "max_score": 6.407021,
    "hits": [{
      "_index": "abc",
      "_type": "xyz",
      "_id": "ABC123",
      "_score": 5.8341036,
      "_source": {
        ...
      }
    }]
  }
}

Antwort auf die zweite Anfrage

{
"took": 27,
"timed_out": false,
"_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
},
"hits": {
    "total": 19543,
    "max_score": 6.407021,
    "hits": [
        {
            "_index": "abc",
            "_type": "xyz",
            "_id": "FGH12343",
            "_score": 5.8341036,
            "_source": {
                ...
            }
        }
    ]
}

}

Was könnte die Ursache dafür sein und wie kann ich für verschiedene Knoten die gleichen Ergebnisse erzielen?

Erläuterte Abfrage wie angefordert: search / abc / mytype / _search? From = 0 & size = 1 & search_type = dfs_query_then_fetch & explain =

{
  "query": {
    "bool": {
      "should": [{
        "match": {
          "address.city": {
            "query": "Karlsruhe",
            "boost": 2
          }
        }
      }]
    }
  }
}

Antwort auf die erste Anfrage

{
    "took": 5,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "hits": {
        "total": 41,
        "max_score": 7.211497,
        "hits": [
            {
                "_shard": 0,
                "_node": "rUZDrUfMR1-RWcy4t0YQNw",
                "_index": "abc",
                "_type": "mytype",
                "_id": "abc123",
                "_score": 7.211497,
                "_source": {...
                },
                "_explanation": {
                    "value": 7.211497,
                    "description": "weight(address.city:karlsruhe^2.0 in 1598) [PerFieldSimilarity], result of:",
                    "details": [
                        {
                            "value": 7.211497,
                            "description": "fieldWeight in 1598, product of:",
                            "details": [
                                {
                                    "value": 1,
                                    "description": "tf(freq=1.0), with freq of:",
                                    "details": [
                                        {
                                            "value": 1,
                                            "description": "termFreq=1.0"
                                        }
                                    ]
                                },
                                {
                                    "value": 7.211497,
                                    "description": "idf(docFreq=46, maxDocs=23427)"
                                },
                                {
                                    "value": 1,
                                    "description": "fieldNorm(doc=1598)"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

Antwort auf die zweite Anfrage

{
    "took": 6,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "hits": {
        "total": 41,
        "max_score": 7.194322,
        "hits": [
            {
                "_shard": 0,
                "_node": "rUZDrUfMR1-RWcy4t0YQNw",
                "_index": "abc",
                "_type": "mytype",
                "_id": "abc123",
                "_score": 7.194322,
                "_source": {...
                },
                "_explanation": {
                    "value": 7.194322,
                    "description": "weight(address.city:karlsruhe^2.0 in 1598) [PerFieldSimilarity], result of:",
                    "details": [
                        {
                            "value": 7.194322,
                            "description": "fieldWeight in 1598, product of:",
                            "details": [
                                {
                                    "value": 1,
                                    "description": "tf(freq=1.0), with freq of:",
                                    "details": [
                                        {
                                            "value": 1,
                                            "description": "termFreq=1.0"
                                        }
                                    ]
                                },
                                {
                                    "value": 7.194322,
                                    "description": "idf(docFreq=48, maxDocs=24008)"
                                },
                                {
                                    "value": 1,
                                    "description": "fieldNorm(doc=1598)"
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    }
}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage