<p dir="auto">Lucene now has sandbox support for BigInteger (<a href="https://issues.apache.org/jira/browse/LUCENE-7043" rel="nofollow">LUCENE-7043</a>), and hopefully BigDecimal will follow soon.  We should look at what needs to be done to support them in Elasticsearch.</p>
<p dir="auto">I propose adding <code class="notranslate">big_integer</code> and <code class="notranslate">big_decimal</code> types which have to be specified explicitly - they shouldn't be a type which can be detected by dynamic mapping.</p>
<p dir="auto">Many languages don't support big int/decimal. Javascript will convert to floats or throw an exception if a number is out of range.  This can be worked around by always rendering these numbers in JSON as strings. We can possibly accept known bigints/bigdecimals as numbers but there are a few places where this could be a problem:</p>
<ul dir="auto">
<li>indexing a known big field (do we know ahead of time to parse a floating point as a BigDecimal?)</li>
<li>dynamic mapping (a floating point number could have lost precision before the field is defined as big_decimal)</li>
<li>ingest pipeline (ingest doesn't know about field mappings)</li>
</ul>
<p dir="auto">The above could be worked around by <a href="https://github.com/FasterXML/jackson-databind/wiki/Deserialization-Features">telling Jackson</a> to parse floats and ints as BIG* (<code class="notranslate">USE_BIG_DECIMAL_FOR_FLOATS</code> and <code class="notranslate">USE_BIG_INTEGER_FOR_INTS</code>) but this may well generate a lot of garbage for what is an infrequent use case.</p>
<p dir="auto">Alternatively, we could just say that Big* should always be passed in as strings if they are to maintain their precision.</p>
<p dir="auto"><strong>Elasticsearch version</strong>: Amazon Elasticsearch  2.3.2</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:<br>
Inserting same field to same index with different mapping don't create new mapping.<br>
Field name change creates new mapping</p>
<p dir="auto">Issue seems to be duplicate of closed <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="130424170" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/16348" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/16348/hovercard" href="https://github.com/elastic/elasticsearch/issues/16348">#16348</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="119670829" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/15138" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/15138/hovercard" href="https://github.com/elastic/elasticsearch/issues/15138">#15138</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="123271347" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/15568" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/15568/hovercard" href="https://github.com/elastic/elasticsearch/issues/15568">#15568</a></p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ curl -XPOST -d '{&quot;timestamp&quot;: &quot;2016/08/18 12:55:43&quot;}' https://aws-elasticsearch/logstash-2016.08.18/test_map1
{&quot;_index&quot;:&quot;logstash-2016.08.18&quot;,&quot;_type&quot;:&quot;test_map1&quot;,&quot;_id&quot;:&quot;AVadvLddEO70PGmPaHHU&quot;,&quot;_version&quot;:1,&quot;_shards&quot;:{&quot;total&quot;:2,&quot;successful&quot;:1,&quot;failed&quot;:0},&quot;created&quot;:true}

$ curl -XPOST -d '{&quot;timestamp&quot;: &quot;2016-08-18T12:42:06.623000+0000&quot;}' https://aws-elasticsearch/logstash-2016.08.18/test_map2  ; echo
{&quot;error&quot;:{&quot;root_cause&quot;:[{&quot;type&quot;:&quot;mapper_parsing_exception&quot;,&quot;reason&quot;:&quot;failed to parse [timestamp]&quot;}],&quot;type&quot;:&quot;mapper_parsing_exception&quot;,&quot;reason&quot;:&quot;failed to parse [timestamp]&quot;,&quot;caused_by&quot;:{&quot;type&quot;:&quot;illegal_argument_exception&quot;,&quot;reason&quot;:&quot;Invalid format: \&quot;2016-08-18T12:42:06.623000+0000\&quot; is malformed at \&quot;-08-18T12:42:06.623000+0000\&quot;&quot;}},&quot;status&quot;:400}

$ curl -XPOST -d '{&quot;ttimestamp&quot;: &quot;2016-08-18T12:42:06.623000+0000&quot;}' https://aws-elasticsearch/logstash-2016.08.18/test_map2  ; echo
{&quot;_index&quot;:&quot;logstash-2016.08.18&quot;,&quot;_type&quot;:&quot;test_map2&quot;,&quot;_id&quot;:&quot;AVadx4_NEO70PGmPaHHc&quot;,&quot;_version&quot;:1,&quot;_shards&quot;:{&quot;total&quot;:2,&quot;successful&quot;:1,&quot;failed&quot;:0},&quot;created&quot;:true}"><pre class="notranslate"><code class="notranslate">$ curl -XPOST -d '{"timestamp": "2016/08/18 12:55:43"}' https://aws-elasticsearch/logstash-2016.08.18/test_map1
{"_index":"logstash-2016.08.18","_type":"test_map1","_id":"AVadvLddEO70PGmPaHHU","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}

$ curl -XPOST -d '{"timestamp": "2016-08-18T12:42:06.623000+0000"}' https://aws-elasticsearch/logstash-2016.08.18/test_map2  ; echo
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse [timestamp]"}],"type":"mapper_parsing_exception","reason":"failed to parse [timestamp]","caused_by":{"type":"illegal_argument_exception","reason":"Invalid format: \"2016-08-18T12:42:06.623000+0000\" is malformed at \"-08-18T12:42:06.623000+0000\""}},"status":400}

$ curl -XPOST -d '{"ttimestamp": "2016-08-18T12:42:06.623000+0000"}' https://aws-elasticsearch/logstash-2016.08.18/test_map2  ; echo
{"_index":"logstash-2016.08.18","_type":"test_map2","_id":"AVadx4_NEO70PGmPaHHc","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
</code></pre></div>