O'Reilly logo

Elasticsearch: A Complete Guide by Saurabh Chhajed, Marek Rogoziński, Rafał Kuć, Bharvi Dixit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling multimatching

Until Elasticsearch 1.1, we had limited control over the multi_match query. Of course, we had the possibility to specify the fields we want our query to be run against; we could use disjunction max queries (by setting the use_dis_max property to true). Finally, we could inform Elasticsearch about the importance of each field by using boosting. Our example query run against multiple fields could look as follows:

curl -XGET 'localhost:9200/library/_search?pretty' -d '{
 "query" : {
  "multi_match" : {
   "query" : "complete conan doyle",
   "fields" : [ "title^20", "author^10", "characters" ]
  }
 }
}'

A simple query that will match documents having given tokens in any of the mentioned fields. In addition to that required query, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required