# DSL query for indices not receiving any documents for the past 5 mins

**URL:** <https://discuss.elastic.co/t/dsl-query-for-indices-not-receiving-any-documents-for-the-past-5-mins/290710>\
**Category:** Elasticsearch\
**Created:** [December 1, 2021, 8:55pm UTC](https://discuss.elastic.co/t/dsl-query-for-indices-not-receiving-any-documents-for-the-past-5-mins/290710 "2021-12-01T20:55:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonisnyc94](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/antonisnyc94/32/94316_2.png) [@antonisnyc94](https://discuss.elastic.co/u/antonisnyc94)\
**Post date:** [December 1, 2021, 8:55pm UTC](https://discuss.elastic.co/t/dsl-query-for-indices-not-receiving-any-documents-for-the-past-5-mins/290710/1 "2021-12-01T20:55:10Z")

</div>

Hello,

We want to set up an alert using opendistro for indices not receiving any docs for the past 5 mins. I used the must\_not exist field "@timestamp" since it always exists in all documents but i get no results.. Does anyone have any workaround? I intentionally stopped logstash to stop sending events to the indices but im getting `0 hits` for the below query. Any help would be greatly appreciated!

```auto
{
    "size": 0,
    "query": {
        "bool": {
            "filter": [
                {
                    "range": {
                        "@timestamp": {
                            "from": "{{period_end}}||-5m",
                            "to": "{{period_end}}",
                            "include_lower": true,
                            "include_upper": true,
                            "format": "epoch_millis",
                            "boost": 1
                        }
                    }
                }
            ],
            "must_not": [
                {
                    "exists": {
                        "field": "@timestamp",
                        "boost": 1
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1
        }
    },
    "aggregations": {}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 29, 2021, 8:55pm UTC](https://discuss.elastic.co/t/dsl-query-for-indices-not-receiving-any-documents-for-the-past-5-mins/290710/2 "2021-12-29T20:55:45Z")

</div>

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