2017-07-12 4 views
2

最近変更された弾性検索バージョン2.4から5.4からバージョンが変更されました。エラスティック検索このような5.xでのクエリスコアの問題

バージョン5.xでこのクエリのように1つの問題が見つかりました。

次のクエリでは、テキストで

Elasticsearch 2.4の

入力問い合わせ

POST /test/_search 
{ 
    "size": 10000, 
"stored_fields": [ 
"docid" 
], 
"_source": false, 
"query": { 
"more_like_this": { 
"fields": [ 
    "textcontent" 
    ], 
    "like": [ 
    { 
     "_index": "test", 
     "_type": "object", 
     "_id": "AV0c9jvZXF-b5U5aNAWB" 
    } 
    ], 
    "max_query_terms": 5000, 
    "min_term_freq": 1, 
    "min_doc_freq": 1 
} 
} 
} 

出力を同様の文書を見つけるために使用されています

{ "took": 16, "timed_out": false, "_shards": { "total": 1, "successful": 1, "failed": 0 }, "hits": { "total": 3, "max_score": 1.5381224, "hits": [ { "_index": "test", "_type": "object", "_id": "AVzjOOdilllQ-Gyal6Z9", "_score": 1.5381224, "fields": { "docid": [ "2" ] } }, { "_index": "test", "_type": "object", "_id": "AVzjOOdilllQ-Gyal63Z", "_score": .5381224, "fields": { "docid": [ "3" ] } }, { "_index": "test", "_type": "object", "_id": "AVzjOOdilllQ-Gyal6Z", "_score": .381224, "fields": { "docid": [ "4" ] } } 

Elasticsearch 5.4

{
"took": 16, 
"timed_out": false, 
"_shards": { 
    "total": 1, 
    "successful": 1, 
    "failed": 0 
}, 
"hits": { 
    "total": 3, 
    "max_score": 1.5381224, 
    "hits": [ 
     { 
      "_index": "test", 
      "_type": "object", 
      "_id": "AVzjOOdilllQ-Gyal6Z9", 
      "_score": 168.5381224, 
      "fields": { 
       "docid": [ 
        "2" 
       ] 
      } 
     }, { 
      "_index": "test", 
      "_type": "object", 
      "_id": "AVzjOOdilllQ-Gyal63Z", 
      "_score": 164.5381224, 
      "fields": { 
       "docid": [ 
        "3" 
       ] 
      } 
     }, { 
      "_index": "test", 
      "_type": "object", 
      "_id": "AVzjOOdilllQ-Gyal6Z", 
      "_score": 132.381224, 
      "fields": { 
       "docid": [ 
        "4" 
       ] 
      } 
     }} 

の出力は、出力は、両方のバージョンで同じであるドキュメントのスコア除い。 バージョン5.4は2.4よりもスコアが高くなっています。 私たちは仕事のスコアに依存していますので、スコアが変わったら私たちの問題です。これを解決してください。

+0

あなたはスコアの差を提供してものを見るためにあなたのクエリで 'explain'オプションを使用することができ、クエリ、次の実行してすべてのインデックスの設定を更新しますか? – Adonis

+1

ありがとう、私はそれが内部アルゴリズムbm25だった解決策を得ました。 クラシックに変更する必要があります。 –

+0

問題がないことは間違いありませんが、質問に答えを書いて未回答の質問に焦点を当てることができますか? – Adonis

答えて

3

私は解決策を得ました。バージョン5.0では、デフォルトの類似性アルゴリズムがclassicからBM25に変更されました。その理由がその理由でした。 インデックスを作成するときに、類似性の種類をclassicに変更するだけです。 と インデックスがすでにある場合に存在してそしてちょうど

PUT /_all/_settings?preserve_existing=true   
{ 
    "index.similarity.default.type": "classic" 
} 
関連する問題