🔍 Elasticsearch
Intermediate
What is a bool query in Elasticsearch?
Answer
The bool query is the primary compound query in Elasticsearch used to combine multiple queries with logical operators. It has four clause types: must — the query must match and contributes to the score (AND); should — the query is optional but boosts the score if it matches (OR); must_not — the query must NOT match (executed in filter context, no score contribution); and filter — the query must match but does NOT contribute to the score and IS cached. For example, a product search might use must for the keyword match, filter for category and price range, and must_not to exclude out-of-stock items.
Previous
What is the difference between query context and filter context in Elasticsearch?
Next
What are aggregations in Elasticsearch?
More Elasticsearch Questions
View all →- Intermediate What is the difference between query context and filter context in Elasticsearch?
- Intermediate What are aggregations in Elasticsearch?
- Intermediate What is the difference between text and keyword field types?
- Intermediate What are index templates and component templates in Elasticsearch?
- Intermediate What is the Reindex API and when would you use it?