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 type
  • The most_fields type
  • The cross_fields type
  • The phrase type
  • The 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" ...

Get Mastering Elasticsearch 5.x - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.