# How to store large numbers in elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957>\
**Category:** Elasticsearch\
**Created:** [August 24, 2015, 3:21pm UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957 "2015-08-24T15:21:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![timoschmidt](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@timoschmidt](https://discuss.elastic.co/u/timoschmidt)\
**Post date:** [August 24, 2015, 3:21pm UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957/1 "2015-08-24T15:21:54Z")

</div>

Hello together,

in our current project we need to store fields in an index with numbers, that are bigger then a long value.  
Is this somehow possible? Currently i get the following error:

Error encountered during bulk load [MapperParsingException[failed to parse [fieldName]]; nested: JsonParseException[Numeric value (18446744073709551612) out of range of long (-9223372036854775808 - 9223372036854775807)

What else is possible?

Thanks and best regards

timo

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [August 24, 2015, 3:44pm UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957/2 "2015-08-24T15:44:50Z")

</div>

> [@timoschmidt](#):
>
> What else is possible?

[double](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-core-types.html#number) is the best you can do and still use the number functions. But you get the corresponding loss of precision. You can store it as a string if you like too.

If you genuinely need more than that I'd file an issue. I _thought_ there was already an issue mentioning arbitrary precision integers but I can't find it now.

---

<div class="post-metadata">

**Author:** ![ea\_fox](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@ea\_fox](https://discuss.elastic.co/u/ea_fox)\
**Post date:** [August 24, 2015, 7:51pm UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957/3 "2015-08-24T19:51:43Z")

</div>

You can store this documents in two different types(long as string, long). First insert documents without exceptions, and after that with exceptions. For example this is available in NEST .Net Bulk insert. Bulk response will return docs with exceptions.

---

<div class="post-metadata">

**Author:** ![timoschmidt](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@timoschmidt](https://discuss.elastic.co/u/timoschmidt)\
**Post date:** [August 25, 2015, 10:08am UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957/4 "2015-08-25T10:08:55Z")

</div>

> [@ea\_fox](#):
>
> First insert documents without exceptions, and after that with exceptions

What do you mean with this? That i need to insert a document twice? Or do you want to say that inserting such a big number as normal long (not long as string), allways results in an exception?

Are you talking about a document, when it is inserted in a schema less mode or with a strict schema?  
In our system we have a string schema, with data type long for this field.

---

<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 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/how-to-store-large-numbers-in-elasticsearch/27957/5 "2017-07-05T23:53:59Z")

</div>


