Build elasticsearch query

Build an Elasticsearch Query DSL request with filters, search, sorting, and aggregations.

freeworks offlinenothing uploaded
ToolElasticsearch Query Builder
Input
Output
—

How it works

Selected clauses are assembled into a JSON Query DSL object; boolean intent determines whether clauses go under must, filter, should, or must_not. The output is a request body and does not query a cluster.

  • Filter clauses avoid scoring when only inclusion matters.
  • Match clauses remain available for full-text relevance.

Worked example

Full-Text Product Search
Build an Elasticsearch match query for product titles
Input
											Query type: match
Index: products
Field: title
Value: wireless headphones
Size: 10
										
Output
												{
  "query": {
    "match": {
      "title": "wireless headphones"
    }
  },
  "from": 0,
  "size": 10
}
											

When to use this

Product search, log dashboards, and reporting jobs build Query DSL bodies.

Edge cases

  • A term query on analyzed text can miss values that match would find.
  • Tied sort keys make from/size pagination unstable.
  • Broad wildcard queries can consume cluster resources.

References