2017-04-07 12 views
0

私はcutoff_frequencyと "and"演算子を組み合わせたelasticsearchクエリを見つけましたが、これは私には意味がありません。弾性検索:cutoff_frequencyとand演算子を組み合わせますか?

これはブールクエリの一部です:

{ 
    "match": { 
     "content": { 
     "query": "I has candy and cake", 
     "cutoff_frequency": 0.001, 
     "operator": "and" 
     } 
    } 
    } 

そしてcutoff_frequencyがします。このマニュアルに従って、(文書に依存しますが、最も可能性が高い)、以下にこれを変換します。

{ 
    "bool": { 
    "must": { 
     "bool": { 
     "should": [ 
      { "term": { "text": "candy" }}, 
      { "term": { "text": "cake" }} 
     ] 
     } 
    }, 
    "should": { 
     "bool": { 
     "should": [ 
      { "term": { "text": "I" }}, 
      { "term": { "text": "has" }}, 
      { "term": { "text": "and" }} 
     ] 
     } 
    } 
    } 
} 

しかし、 "and"演算子がクエリに追加されているとどうなりますか?これは "cutoff_frequency"が効果がないことを意味しますか?

答えて

1

効果があります。

Elastic Documentationドキュメントからの一致クエリは、高周波用語は、任意のサブクエリに移動され、低周波の 1つが のみが獲得される絶対的または相対的な文書頻度を特定可能cutoff_frequencyをサポートオペレータまたはオペレータの場合は(カットオフより下の)用語であり、オペレータがである場合は、すべての低頻度用語が です。

UPDATE:私は、クエリに誤解されている

はそのように見える:

{ 
"bool": { 
    "must": { 
     "bool": { 
     "must": [ 
      { "term": { "text": "candy" }}, 
      { "term": { "text": "cake" }} 
     ] 
    } 
    }, 
"should": { 
    "bool": { 
     "should": [ 
     { "term": { "text": "I" }}, 
     { "term": { "text": "has" }}, 
     { "term": { "text": "and" }} 
     ] 
    } 
    } 
    } 
} 

そして、あなたの質問私の例ではそう

+0

"はい、両方の用語に一致する場合にのみ" を答えます上記の頻度の高い用語(I、has、and)は、私の低頻度の用語(キャンディー、ケーキ)がすべて文書に含まれている場合にのみスコアリングに貢献しますか? –

関連する問題