Multimatch types
In this section, we will cover the different flavors of multi-match
queries, which are mainly controlled using the type
property. The following are the available types:
The
best_fields
typeThe
most_fields
typeThe
cross_fields
typeThe
phrase
typeThe
phrase_prefix
type
Best fields matching
To use the best_fields
type matching, one needs to set the type
property of the multi_match
query to the best_fields
query. This type of multimatching will generate a match
query for each field specified in the fields
property and it is best used for searching for multiple words in the same best matching field. For example, let's look at the following query:
curl -XGET 'localhost:9200/library/_search?pretty' -d '{
"query" : {
"multi_match" : {
"query" : "complete conan doyle",
"fields" : [ "title", "author", "characters" ],
"type" : "best_fields",
"tie_breaker" : 0.8
}
}
}'
The preceding query would be translated into a query similar to the following...