# Number is equal to Query?

**URL:** <https://discuss.elastic.co/t/number-is-equal-to-query/120666>\
**Category:** Elasticsearch\
**Created:** [February 20, 2018, 2:38pm UTC](https://discuss.elastic.co/t/number-is-equal-to-query/120666 "2018-02-20T14:38:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yair\_Halberstadt](https://avatars.discourse-cdn.com/v4/letter/y/779978/32.png) [@Yair\_Halberstadt](https://discuss.elastic.co/u/Yair_Halberstadt)\
**Post date:** [February 20, 2018, 2:38pm UTC](https://discuss.elastic.co/t/number-is-equal-to-query/120666/1 "2018-02-20T14:38:37Z")

</div>

I want to check if a number is equal to some other in my query.

Let's put in some test data:

```
PUT newindex/test/123
{
  "num":20
}
PUT newindex/test/12
{
  "num":20.0
}

```

Now I want to return all cases where num is 20 - so both results.

A term query doesn't work, since one of the numbers is 20.0.

Neither does this range query:

```
GET newindex/_search
{
  "query": {
    "range": {
      "num": {
        "gte": 20,
        "lte": 20
        
      }
    }
  }
}

```

This does, but it's a hack, and not very robust:

```
GET newindex/_search
{
  "query": {
    "range": {
      "num": {
        "gte": 20,
        "lte": 20.0
        
      }
    }
  }
}

```

Is there no way to create such a straightforward query?

---

<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:** [March 20, 2018, 2:38pm UTC](https://discuss.elastic.co/t/number-is-equal-to-query/120666/2 "2018-03-20T14:38:45Z")

</div>

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