Compound queries

As we have already discussed, in addition to simple queries, ElasticSearch exposes a few compound queries that can be used to connect multiple queries together or are used to control the behavior of another query. You may wonder whether you need such functionality. In fact, if you are interested in making your search better, you'll use the following queries somewhere in your journey with ElasticSearch. A simple example is combining a simple term query with a phrase query in order to get better search results. But for now, let's stick to the query description.

The bool query

A bool query allows us to wrap a virtually unbounded number of queries and connect them with a logical value by using one of the following sections:

  • should ...

Get ElasticSearch Server 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.