[Elasticsearch - The Definitive Guide] Phrase Matching
Elastic/TheDefinitiveGuide 2015. 12. 15. 11:20match query type 중 phrase 에 대한 이해를 돕기 위해 기록 합니다.
원문링크)
https://www.elastic.co/guide/en/elasticsearch/guide/current/phrase-matching.html
원문 Snippet)
What Is a Phraseedit
For a document to be considered a match for the phrase “quick brown fox,” the following must be true:
quick
,brown
, andfox
must all appear in the field.- The position of
brown
must be1
greater than the position ofquick
. - The position of
fox
must be2
greater than the position ofquick
.
If any of these conditions is not met, the document is not considered a match.
Internally, the match_phrase
query uses the low-level span
query family to do position-aware matching. Span queries are term-level queries, so they have no analysis phase; they search for the exact term specified.
Thankfully, most people never need to use the span
queries directly, as the match_phrase
query is usually good enough. However, certain specialized fields, like patent searches, use these low-level queries to perform very specific, carefully constructed positional searches.
다시 한번 정리 하면,
- position-aware matching 을 이용하는 span query
- 첫번째 term 에 대한 position에 의해 나머지 term 들의 matching position 은 quick의 position 보다 커야 합니다.