여러 필드에 대해 match 적용하는 쿼리
type: best_fields
, most_fields
, cross_fields
, phrase
, phrase_prefix
, bool_prefix
best_fields
: 나열된 필드 중 제일 높은 score를 가져오기 (default 설정)most_fields
: 각 필드들에 match 하고 score 를 합산한다.bool
쿼리로 should
로 match 한 것과 같은 결과cross_fields
: 같은 analyzer 가 적용된 필드들에 대해 1개 이상 매칭phrase
: 여러 필드에서 match_phrase
검색phrase_prefix
: 여러 필드에 match_phrase_prefix
실행bool_prefix
: most_fields
와 유사하지만 match 쿼리 대신 match_bool_prefix 쿼리 사용GET /_search
{
"query": {
"multi_match" : {
"query": "quick brown fox",
"type": "most_fields",
"fields": [ "title", "title.original", "title.shingles" ]
}
}
}
GET /_search
{
"query": {
"multi_match" : {
"query": "Will Smith",
"type": "cross_fields",
"fields": [ "first_name", "last_name" ],
"operator": "and"
}
}
}
.edge
하위 필드에 edge ngram 적용했다면 그 필드들로만 매칭GET /_search
{
"query": {
"multi_match" : {
"query": "Jon",
"type": "cross_fields",
"fields": [
"first", "first.edge",
"last", "last.edge"
]
}
}
}