我正在將Elasticsearch實例從1.7升級到5.4.3,並且注意到兩個系統之間的搜索結果不同,即使使用相同的查詢。Elasticsearch查詢結果從1.7遷移到5.4時有所不同
Elasticsearch 1.7查詢
{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "something",
"fields": [
"field1",
"field2",
"field3"
],
"operator": "and"
}
}
}
}
}
Elasticsearch 5.4查詢
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "something",
"fields": [
"field1",
"field2",
"field3"
],
"operator": "and"
}
}
]
}
}
}
在Elasticsearch 1.7的第一個搜索結果將成爲第71屆結果Elasticsearch 5.4。當我用_explain
端點查看1.7和5.4之間的相同搜索結果時,我發現評分完成的方式不同。此外,此查詢還包含搜索查詢所匹配的同義詞。
解釋Elasticsearch 1.7
{
"_index": "...",
"_type": "...",
"_id": "...",
"matched": true,
"explanation": {
"value": 9.963562,
"description": "max of:",
"details": [
{
"value": 3.1413355,
"description": "sum of:",
"details": [
{
"value": 1.0609967,
"description": "weight(field1:something in 13) [PerFieldSimilarity], result of:",
"details": [
...remainder removed for brevity
解釋Elasticsearch 5.4
{
"_index": "...",
"_type": "...",
"_id": "...",
"matched": true,
"explanation": {
"value": 7.1987557,
"description": "sum of:",
"details": [
{
"value": 7.1987557,
"description": "max of:",
"details": [
{
"value": 6.659632,
"description": "weight(Synonym(field1:something field1:something2 field1:something3) in 113) [PerFieldSimilarity], result of:",
"details": [
...remainder removed for brevity
問題
- 任何OB。在兩個版本中爲什麼我的搜索結果對於同等查詢會有如此不同?
- 是否事實
_explain
查詢Elasticsearch 1.7顯示比sum of
進行計算更高max of
,它是Elasticsearch 5.4 相反,表明了問題的一部分?