11 Compound queries

This chapter covers

  • Working with compound queries
  • Boolean search queries
  • Constant score queries
  • Boosting queries
  • Disjunction maximum queries
  • Function score queries

In the last two chapters, we looked at term-level and full-text queries. We discussed searching structured and unstructured data using queries, some producing relevance scores and others working in a filter context where scores are irrelevant. Most queries allow setting simple search criteria and working on a limited set of fields, such as finding books written by an author or searching for best-selling books.

In addition to providing queries for complex criteria, we sometimes need to boost scores based on certain criteria while at the same time negating scores ...

Get Elasticsearch in Action, Second 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.