Build must, filter, should, must_not, and nested groups visually.
Elasticsearch Query Builder
Build production-ready Query DSL without wrestling with JSON: conditions, bool logic, sorting, aggregations, and mapping-aware checks, with a ready request for the API or Kibana.
Examples:
Which query type should I pick?
Quick cheat sheet: searching for words in text — match; an exact value (status, tag, ID) — term for one and terms for several; a range of numbers or dates — range; checking that a field is present — exists; pattern search — wildcard or prefix; typo-tolerant search — fuzzy; a complex expression with AND/OR — query_string; parenthesized logic like A AND (B OR C) — a nested bool group.
| Type | When to use | Example |
|---|---|---|
match | Full-text search: the text is split into words and documents matching any of them are found (analyzer-aware). For text fields. | title : wireless headphones |
match_phrase | Exact phrase search: the words must appear consecutively and in the same order. For text fields. | message : "out of memory" |
term | Exact value match with no text analysis. For keyword, numbers, dates, and booleans; for text fields use the .keyword sub-field. | status : published |
terms | Exact match against any of the listed values — like IN in SQL. Values are comma-separated. | status : draft, published |
range | A range of values: from (gte) and/or to (lte). Works for numbers and dates, supports expressions like now-7d. | price : 100 … 500 / created_at : now-7d … |
exists | Finds documents where the field exists and is not null. No value required. | email |
wildcard | Pattern search: * matches any number of characters, ? matches one. Runs against the exact value (keyword); patterns starting with * are slow. | host : web-* |
prefix | Finds values that start with the given string. For keyword fields. | sku : AB- |
fuzzy | Typo-tolerant search (edit distance): "adidsa" will find "adidas". | brand : adidsa → adidas |
query_string | A Lucene-syntax expression: AND, OR, NOT, parentheses, quotes, field:value. Powerful but strict about syntax. | (error OR warn) AND service:api |
bool (group) | A nested bool group: combines several conditions into one block — like parentheses in a logical expression. Needed for logic like A AND (B OR C); the same must / filter / should / must_not are available inside, and groups can be nested within each other. | status:active AND (type:a OR type:b) |
No conditions — a match_all query will be generated.
Advanced settings
Paste your index mapping — the full GET /index/_mapping response or just the mappings / properties block. Field name autocomplete will appear, and the validator will start checking that each query type matches the field type.
How a bool query works.
In Elasticsearch, conditions are combined inside a bool query: must works like AND and affects relevance scoring, filter works like AND without scoring (faster and cacheable), should works like OR, and must_not excludes documents. If only one must condition is set, the builder outputs it without the bool wrapper.
Catch missing fields, costly wildcards, and aggregations on text.
Import existing DSL, adjust it visually, then copy JSON, cURL, or Kibana.
Free online Elasticsearch query builder. Compose Query DSL requests visually instead of writing JSON by hand: pick a query type (match, match_phrase, term, terms, range, exists, wildcard, prefix, fuzzy, query_string), specify the field and value, and choose the bool context — must, filter, should, or must_not. A built-in cheat sheet explains which query type to pick in each situation.
Paste your index mapping and the builder starts autocompleting field names and validating the query: it warns about term on a text field, match on keyword, sorting or aggregating on text, non-existent fields (with a "did you mean" suggestion), swapped range bounds, and other common mistakes. The tool also supports nested bool groups for logic like A AND (B OR C), automatic wrapping of conditions on nested fields in a nested query, sorting, from/size pagination, _source, track_total_hits, minimum_should_match, and aggregations: terms, avg, sum, min, max, cardinality, value_count, date_histogram, histogram. The result is available as JSON, cURL, or a Kibana Dev Tools snippet.
Everything runs locally in your browser — queries are not sent or stored anywhere. A handy tool for developers, DevOps engineers, and analysts working with Elasticsearch and OpenSearch: prototype a search query, debug a bool filter, or prepare an aggregation request in seconds.