Dev
Générateur de requêtes Elasticsearch fictives
A mock Elasticsearch query generator produces example query DSL in JSON for testing, learning, and documentation. Elasticsearch queries are written as nested JSON with their own structure — bool queries, must and filter clauses, ranges, and sorts — and a realistic sample is the fastest way to learn the DSL or test a parser. This tool emits a valid query combining a match, filters, a date range, and a sort. Click generate and copy it into a test, a console, or a tutorial. It is ideal for learning the Elasticsearch query DSL, building a mock search, and documenting a query. The JSON follows the real DSL structure, so it shows how clauses nest — a bool query with must and filter, a range with date math, and a sort. Adapt the fields, terms, and clauses to your own index and mapping before running it against a real cluster.
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Click Generate to produce a query.
- Copy the JSON into a console or test.
- Adapt the fields and terms to your index.
- Run it after tailoring to your mapping.
Use Cases
- •Learning the Elasticsearch query DSL
- •Building a mock search query
- •Documenting a search feature
- •Testing a query parser
- •Seeding example queries
Tips
- →must affects relevance; filter does not.
- →filter clauses can be cached.
- →Adapt fields to your mapping.
- →Use date math like now-7d/d.
FAQ
what is the Elasticsearch query DSL
It is the JSON-based language Elasticsearch uses to express searches, with constructs like bool queries, match and term clauses, ranges, and sorts. Queries nest these together, and this tool generates a realistic sample of that structure.
what is the difference between must and filter
Both narrow results, but must clauses contribute to the relevance score while filter clauses do not and can be cached, making them faster for yes-or-no conditions like a status or date range. The sample uses each appropriately.
can i run this query directly
It is a learning and testing sample. Adapt the fields, terms, and clauses to match your own index and mapping first. The structure is correct DSL; the specific fields need to reflect your real data before it returns useful results.
What is the difference between a term and a match query?
A term query looks for an exact, un-analysed value (good for keywords, IDs, and enums), while a match query runs the text through the same analyzer as the field for full-text search, handling tokenisation and relevance. Using term on analysed text is a classic gotcha. The generator produces DSL using these query types, so you can see and test the right one for each field.
What is a bool query in Elasticsearch?
A bool query combines clauses with must (AND, scored), should (OR, boosts score), must_not (exclude), and filter (AND, unscored and cacheable) — the workhorse for building compound searches. The generator emits realistic bool queries, so your code that constructs, parses, or proxies Elasticsearch DSL is tested against the structure real applications send rather than a single flat query.
You might also like
Popular tools from other categories that share themes with this one.
Try these next
More free tools from other corners of the catalog, picked by shared themes.