How do I get current records in elasticsearch for the current time?

Viewed 14

When I run the below query on elastic-search, I get the record for last 15 minutes. But suppose I am entering 12:05 hour and if I run this query then it will obviously get record for 11th hour also. So what I am looking is to get the record for current hour only. So whichever hour I am entering, I should get record for that hour only.

{
    "query": {
        "bool": {
            "filter": [
                {
                    "range": {
                        "@timestamp": {
                            "from": "{{period_end}}||-15m",
                            "to": "{{period_end}}",
                            "include_lower": true,
                            "include_upper": true,
                            "format": "epoch_millis",
                            "boost": 1
                        }
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1
        }
    },
    "aggregations": {}
}
0 Answers
Related