How to filter last 5 minutes, date histogram using Elastic search?
Ok so I got it working here is the query...
{ "size": 0, <--- Size zero. Don't return any docs we only care about the aggregation. "aggs": { "last_5_mins": { "filter": { "range": { "hitTime": { "gte": "now-5m", "lte": "now" } } }, "aggs": { "tps": { "date_histogram": { "field": "hitTime", "interval": "second" } } } } }}