# Exact match on large float

**URL:** <https://discuss.elastic.co/t/exact-match-on-large-float/197091>\
**Category:** Elasticsearch\
**Created:** [August 28, 2019, 10:55am UTC](https://discuss.elastic.co/t/exact-match-on-large-float/197091 "2019-08-28T10:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carasel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carasel/32/51435_2.png) [@carasel](https://discuss.elastic.co/u/carasel)\
**Post date:** [August 28, 2019, 10:55am UTC](https://discuss.elastic.co/t/exact-match-on-large-float/197091/1 "2019-08-28T10:55:58Z")

</div>

I have a field mapped as a float, which is currently storing very large numbers. When I try to search for an exact match on this field, I often end up with results which are not exact matches:

```
"query": {
	 "constant_score" : {
        "filter" : {
            "term": {
                 "myFloat": -23463951 **15141076975**
            }
        }
    }
}

```

Give a result with myFloat = -23463951 **66282373000**

I realise that as these being used like IDs they should probably be mapped as keyword (or at least long as they are all whole numbers), but given that they already exist as floats, is it possible to get exact matches on them?

---

<div class="post-metadata">

**Author:** ![Ignacio\_Vera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ignacio_vera/32/36674_2.png) [@Ignacio\_Vera](https://discuss.elastic.co/u/Ignacio_Vera)\
**Post date:** [August 28, 2019, 11:07am UTC](https://discuss.elastic.co/t/exact-match-on-large-float/197091/2 "2019-08-28T11:07:48Z")

</div>

The answer is no as those big numbers are internally cast to floats so it might happen that two different numbers resolve to the same float and therefore you get multiple matches.

---

<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:** [September 25, 2019, 11:07am UTC](https://discuss.elastic.co/t/exact-match-on-large-float/197091/3 "2019-09-25T11:07:49Z")

</div>

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