# How can we compare no of hits in query

**URL:** <https://discuss.elastic.co/t/how-can-we-compare-no-of-hits-in-query/318631>\
**Category:** Elasticsearch\
**Created:** [November 10, 2022, 8:58am UTC](https://discuss.elastic.co/t/how-can-we-compare-no-of-hits-in-query/318631 "2022-11-10T08:58:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket\_Pant](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Aniket\_Pant](https://discuss.elastic.co/u/Aniket_Pant)\
**Post date:** [November 10, 2022, 8:58am UTC](https://discuss.elastic.co/t/how-can-we-compare-no-of-hits-in-query/318631/1 "2022-11-10T08:58:40Z")

</div>

I am using metricbeat for getting system uptime. When a system goes down , the no of hits is less than 1. Is there any way we can add that no\_of\_hits \< 1 in a query.

Earlier i am using this query. But i did not get any result

```auto
 "query": {
    "bool": {
      "must": [
        {
          "term": {
            "metricset.name": "uptime"
          }
        },
        {
          "range": {
            "system.uptime.duration.ms": {
              "lt": 0
            }
          }
        }
      ]
    }
  }

```

I shutdown one system but i didn't get any result.

---

<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 8, 2022, 8:59am UTC](https://discuss.elastic.co/t/how-can-we-compare-no-of-hits-in-query/318631/2 "2022-12-08T08:59:33Z")

</div>

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