Building advanced search queries with Query DSL
In this recipe, we’ll explore more advanced Query DSL techniques to enhance your search and analysis tasks.
Getting ready
Ensure that you have completed the previous Searching with Query DSL recipe.
You can find the snippets for this recipe at https://github.com/PacktPublishing/Elastic-Stack-8.x-Cookbook/blob/main/Chapter3/snippets.md#building-advanced-search-query-with-query-dsl.
How to do it...
In the previous recipe, we mostly saw queries for full-text search, ideal for searching words within bodies of text. But how do we query for numbers, dates, and IPs? This is where the range query becomes useful. Let’s explore how to find movies released between 1925 and 1927:
- Start with a range query for the
"release_year"
field: Go to Dev Tools | Console in Kibana and try the query with the following code snippet (you can find the snippet at https://github.com/PacktPublishing/Elastic-Stack-8.x-Cookbook...