Elasticsearch has a handful of advanced queries dedicated to serving a specialized function. For example, boosting the score for cafes serving chilled drinks at a specified location using distance_feature query — the …

Earlier in other articles we’ve set the _sourceflag to false to suppress the documents returned in the response. Although we used it for all-or-nothing scenarios, there are a couple of use cases where …

Elasticsearch provides a mechanism to understand the makeup of relevancy scores. This mechanism tells us exactly how the engine calculates the score. This is achieved by using an explain flag on a …

When we search across multiple indices, we may want to have a document found in one index take precedence over the same document found in another index. That is, we …

Elasticsearch provides capabilities to add additional features such as pagination, sorting, field manipulation and others to the queries and its results. Let’s look at them in the next few sections. …

You may have observed that search queries return the results from the original documents specified with the _source field. Occasionally, we may want to fetch only a subset of fields. For …

We can sort the documents based on one or more fields in addition to sorting on the document’s relevancy score. The results returned by the engine are sorted by default …

In this article, let’s look at the search API and learn about ways to invoke the engine to carry out search queries. Elasticsearch exposes a search endpoint for communicating with …

A lot happens when a user invokes a search query against Elasticsearch. Although we touched on the mechanics earlier, let’s recap what we learned. The figure below shows the mechanics …

Documents are expected to have hundreds of fields — for example, a tweet consists of hundreds of field and so is a Trade in a finanancial organization. Fetching all the …

At times, we may have a set of IDs that we would like to get them from Elasticsearch. The IDs query, as the name suggests, fetches the documents given a …

As the name suggests, the terms (note down the plural) query searches multiple criteria against a single field. That is, we can throw in all the possible values of the field that …

Oftentimes, we need a set of data that falls within a range: flights that were delayed between certain dates, profit sales on a particular day, pupils with average height in …

The sourcecode for this (and other topics) code is available here on my GitHub repo. You can download the movies data and index them. Wildcard queries let you search on words with missing characters, …

At times we might want to query for words using a prefix, like Leo for Leonardo or Mar for Marlon Brando, Mark Hamill, or Martin Balsam. Elasticsearch provides a prefix query for fetching records that match …