# How are numeric data types indexed?

**URL:** <https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418>\
**Category:** Elasticsearch\
**Created:** [June 25, 2019, 7:08pm UTC](https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418 "2019-06-25T19:08:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shekharshan](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@shekharshan](https://discuss.elastic.co/u/shekharshan)\
**Post date:** [June 25, 2019, 7:08pm UTC](https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418/1 "2019-06-25T19:08:33Z")

</div>

I wanted to understand how numeric data types such as integer and long are indexed. I think it should get indexed like keywords, without any analysis. Is there any need or benefit to also mapping a numeric type with a 'keyword' type?

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [June 25, 2019, 8:21pm UTC](https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418/2 "2019-06-25T20:21:40Z")

</div>

There are lots of different mapping types you can use for numeric values, depending on the precision you need. Take a look at [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html).

The numeric types are optimised for the type of searches you would typically run against a numeric type, like ranges. This means that there is some extra data stored along with the value.

If you're not going to be running range queries on the numeric fields and are just storing them for lookup, aggregation or ordering purposes, using a `keyword` mapping type is more efficient as the extra data isn't generated or stored.

---

<div class="post-metadata">

**Author:** ![shekharshan](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@shekharshan](https://discuss.elastic.co/u/shekharshan)\
**Post date:** [June 25, 2019, 8:23pm UTC](https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418/3 "2019-06-25T20:23:55Z")

</div>

@whatgeorgemade, its very helpful explanation! Thanks a bunch.

---

<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:** [July 23, 2019, 8:28pm UTC](https://discuss.elastic.co/t/how-are-numeric-data-types-indexed/187418/4 "2019-07-23T20:28:37Z")

</div>

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