# BigDecimal in ElasticSearch

**URL:** <https://discuss.elastic.co/t/bigdecimal-in-elasticsearch/12787>\
**Category:** Elasticsearch\
**Created:** [July 15, 2013, 6:02am UTC](https://discuss.elastic.co/t/bigdecimal-in-elasticsearch/12787 "2013-07-15T06:02:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameer\_mohammed](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@sameer\_mohammed](https://discuss.elastic.co/u/sameer_mohammed)\
**Post date:** [July 15, 2013, 6:02am UTC](https://discuss.elastic.co/t/bigdecimal-in-elasticsearch/12787/1 "2013-07-15T06:02:34Z")

</div>

Hi

I have an oracle table where most of the number fields are BigDecimal. I  
want to migrate all the data from the table to elasticsearch. If I don't  
provide any mapping, elasticsearch is taking the bigdecimal values as  
double and the precision is lost. I was wondering if elasticsearch  
provides the support for BigDecimal field type. My understanding is that it  
doesn't support(  
[http://www.elasticsearch.org/guide/reference/mapping/core-types/](http://www.elasticsearch.org/guide/reference/mapping/core-types/)). Right  
now , as a workaround, I have used an explicit mapping where I mapped all  
the BigDecimal fields to String. My question is how do I efficiently index  
these bigdecimal fields, because I believe that using a string for  
bigdecimal has performance issues.

Thanks  
Sameer

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 15, 2013, 8:34am UTC](https://discuss.elastic.co/t/bigdecimal-in-elasticsearch/12787/2 "2013-07-15T08:34:28Z")

</div>

Yes, elastisearch supports it.

> <https://github.com/elastic/elasticsearch/pull/2188>
>
> A pull request on demand for supporting BigDecimal in XContentBuilder
> https://gr…oups.google.com/forum/?fromgroups#!topic/elasticsearch/H74o1mNZXPk%5B1-25%5D

What kind of performance issues do you mean? If you want fast floating  
points, do not use BigDecimal.

BigDecimal has to be converted to double or formatted to string anyway,  
because there is no JSON big decimal support. You can parameterize the  
conversion by scale und rounding mode (default is the scale in big  
decimal value and rounding mode HALF\_UP)

Jörg

Am 15.07.13 08:02, schrieb sameer mohammed:

> I was wondering if elasticsearch provides the support for BigDecimal  
> field type.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:26am UTC](https://discuss.elastic.co/t/bigdecimal-in-elasticsearch/12787/3 "2017-07-06T02:26:31Z")

</div>


