Newbie in querying ES, I'm wondering if a search, which only returns aggregation data, something like this:
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "<some query>"
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": <epoch low>,
"lte": <epoch high>,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
}
}
},
"size": 0,
"aggs": {
"data": {
"terms": {
"field": "<bucket field>",
"size": 5,
"order": {
"_count": "desc"
}
}
}
}
}
could be constrained further to only return data if bucket counts are above a threshold or in a range and if so how?
TIA
# curl -s -XGET 'http://127.0.0.1:9200/<index>/<type>/_search' -d@es.queries/uniq.boxes | jq .aggregations.data.buckets
[
{
"key": "200000724940",
"doc_count": 1191
},
{
"key": "200001272797",
"doc_count": 1189
},
{
"key": "200001192179",
"doc_count": 106
},
{
"key": "9025586118600015778",
"doc_count": 15
},
{
"key": "200001169953",
"doc_count": 10
}
]