Count API returning zero intermittely

I have a alert check on my elastic search for last 5 min count, if its zero then its send email alert.

The problem is elastic search intermittently returning zero count for last 5 min count. The curl url is

curl --header "Content-Type:application/json" -d '{"query": {"range" : {"@timestamp" : {"gte" : "now-5m", "lt" : "now"}}}}' http://<elk_ulr>/_all/_count

If hit this url continuously below are the results ....

{"count":0,"_shards":{"total":432,"successful":432,"skipped":0,"failed":0}}
{"count":0,"_shards":{"total":432,"successful":432,"skipped":0,"failed":0}}
{"count":170482,"_shards":{"total":432,"successful":432,"skipped":0,"failed":0}}
{"count":170270,"_shards":{"total":432,"successful":432,"skipped":0,"failed":0}}
{"count":169230,"_shards":{"total":432,"successful":432,"skipped":0,"failed":0}}

Why i am getting some time zero and some time count. Please help me on this inconsistency.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.