A worked example, rendered from real sample data. Sign in to run the tool on your own input.
products
iphone 14
{"category": "electronics", "inStock": true}{
"index": "products",
"body": {
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "iphone 14",
"fields": [
"title",
"content"
]
}
}
],
"filter": [
{
"term": {
"category": "electronics"
}
},
{
"term": {
"inStock": true
}
}
]
}
},
"aggs": {
"stats": {
"stats": {
"field": "date"
}
}
},
"size": 20
}
}
Build Elasticsearch queries with filters and aggregations. Part of the DevTools Surf developer suite. Browse more tools in the Database Tools collection.