Whereas a phrase query simply excludes documents that don’t contain the exact query phrase, a proximity query—a phrase query where slop is greater than 0—incorporates the proximity of the query terms into the final relevance _score. By setting a high slop value like 50 or 100, you can exclude documents in which the words are really too far apart, but give a higher score to documents in which the words are closer together.
phrase query는, 정확하게 query 절을 포함하고 있지 않은 document는 단순하게 제외하는 반면에,proximity query (slop 이 0 보다 큰 phrase query)는 query 단어의 근접성(proximity)을 최종 relevance_score 에 포함시킨다. 50, 100 같은 높은 slop 값을 설정하여, 단어가 너무 멀리 떨어져 있는 document를 제외할 수 있다. 그러나, 단어가 서로 더 가까이 있는 document에게는 더 높은 score를 준다.
The following proximity query for quick dog matches both documents that contain the words quickand dog, but gives a higher score to the document in which the words are nearer to each other:
다음의 quick dog 에 대한 proximity query는, quick 과 dog 이라는 단어를 포함하고 있는 두 document 모두와 일치한다. 그러나, 단어가 서로 더 가까이 있는 document에게, 더 높은 score를 준다.
POST /my_index/my_type/_search { "query": { "match_phrase": { "title": { "query": "quick dog", "slop": 50} } } }
{ "hits": [ { "_id": "3", "_score": 0.75,"_source": { "title": "The quick brown fox jumps over the quick dog" } }, { "_id": "2", "_score": 0.28347334,
"_source": { "title": "The quick brown fox jumps over the lazy dog" } } ] }
'2.X > 2. Search in Depth' 카테고리의 다른 글
| 2-4-2. Mixing It Up (0) | 2017.09.24 |
|---|---|
| 2-4-3. Multivalue Fields (0) | 2017.09.24 |
| 2-4-5. Proximity for Relevance (0) | 2017.09.24 |
| 2-4-6. Improving Performance (0) | 2017.09.24 |
| 2-4-7. Finding Associated (0) | 2017.09.24 |