Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Elasticsearch - Second Edition

You're reading from   Mastering Elasticsearch - Second Edition Further your knowledge of the Elasticsearch server by learning more about its internals, querying, and data handling

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783553792
Length 434 pages
Edition 2nd Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Preface 1. Introduction to Elasticsearch FREE CHAPTER 2. Power User Query DSL 3. Not Only Full Text Search 4. Improving the User Search Experience 5. The Index Distribution Architecture 6. Low-level Index Control 7. Elasticsearch Administration 8. Improving Performance 9. Developing Elasticsearch Plugins Index

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 title field is more important than the author field, and finally the characters field.

Of course, we could also use the disjunction max query:

curl -XGET 'localhost:9200/library/_search?pretty' -d '{
 "query" : {
  "multi_match" : {
   "query...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime