Skip to content
100% local

Elasticsearch query builder

Turn a list of field/operator/value conditions into an Elasticsearch bool query.

Output

Elasticsearch query builder

Paste a list of conditions and this tool assembles a complete Elasticsearch search request: a bool query with must, should, must_not and filter branches, plus sorting, pagination and an optional aggregation. It suits anyone who writes queries by hand for Kibana Dev Tools, a REST client or an application's search layer and would rather describe the conditions than retype the JSON scaffolding every time.

Each condition is one line in the Conditions field: an optional branch (must, should, must_not, filter), a field name, an optional condition type (term for an exact match, match for full-text search, range for comparisons, exists to check a field is present), and a value — separated by semicolons. "filter price range 100..500" builds a range clause; "should title match wireless headphones" builds a full-text match on a phrase; "must email exists" checks the field is set. Leave the type off and Default condition type fills it in; leave the branch off and Default branch does the same, so a quick list like "status active; category electronics" still produces a valid query.

The options panel covers the rest of a real search request: Sort field and order add a sort clause, Page size and Offset control from/size pagination, and Aggregation turns on a terms or date_histogram bucket over a field you choose. Highlight matches adds a highlight block for any match conditions, and Query language version toggles track_total_hits, available only from Elasticsearch 7 onward.

Everything runs in your browser — the conditions you type and the query that comes out are never uploaded anywhere. Copy the result straight into Kibana Dev Tools or a request body, download it as a .txt file, or send the output back to the input to keep refining it.

FAQ

How do I write a condition?
One line per condition, separated by semicolons: an optional branch, the field name, an optional condition type, then the value — for example "must status term active; filter price range 100..500".
What do term, match, range and exists mean?
term matches a field exactly, match searches full text, range compares a field against bounds (write "min..max", "min..", "..max", or ">=5"), and exists just checks the field is present — no value needed.
What happens if I leave the branch or type out?
The Default branch and Default condition type options fill in whichever part a line omits, so a plain "field value" line still produces a valid condition.
Does the query work with every Elasticsearch version?
The bool query, sorting, pagination, aggregations and highlighting are stable since Elasticsearch 6. The Query language version option only changes one detail: track_total_hits, which was introduced in Elasticsearch 7 and is left out for a 6.x query.
Is my query data uploaded anywhere?
No. The query is built entirely in your browser from the conditions and options you enter — nothing is sent to a server.