# Disabling number\_detection in dynamic mapping?

**URL:** <https://discuss.elastic.co/t/disabling-number-detection-in-dynamic-mapping/15539>\
**Category:** Elasticsearch\
**Created:** [January 31, 2014, 9:09pm UTC](https://discuss.elastic.co/t/disabling-number-detection-in-dynamic-mapping/15539 "2014-01-31T21:09:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andra\_Bennett](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Andra\_Bennett](https://discuss.elastic.co/u/Andra_Bennett)\
**Post date:** [January 31, 2014, 9:09pm UTC](https://discuss.elastic.co/t/disabling-number-detection-in-dynamic-mapping/15539/1 "2014-01-31T21:09:30Z")

</div>

Hi,

I'm using elasticsearch 0.90.9 as an embedded node and have problems with  
numeric\_detection of data in a dynamically-mapped type.

I'd like to index data with dynamic mapping, however I'm hitting a  
MapperParsingExeption due to attempting to parse a string as a number.  
I understand types are propagated to other elements based on the type  
assignment of the first instance. So for input data below I think I need to  
disable number\_detection on the index.

contact :{ info: { 232-433-5435 }, info: { [email@email.com](mailto:email@email.com) } }

So I tried specifically setting the numeric\_detection on the index to false

client.admin().indices().prepareCreate(indexName).addMapping(type,  
jsonMapping).execute().actionGet();

The mapping for that type doesn't look right: {"requests":{"properties":{}}}

Here is how I get the type mapping in the Java API  
ClusterState cs = client.admin().cluster().prepareState().setFilterIndices(  
indexName).execute().actionGet().getState();  
IndexMetaData imd = cs.getMetaData().index(indexName);  
MappingMetaData mdd = imd.mapping(typeName);  
mdd.source().string())

Furthermore, I get the same exception upon indexing MapperParsingException:

failed to parse [contact.info] .... Caused by:  
java.lang.NumberFormatException: For input string: "foobar"

Is the numeric\_detection field the problem in this setting? How else can it  
be accessed from the Java API?

Thanks!

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9253ee13-44d6-4513-bee8-dd74759d96c9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9253ee13-44d6-4513-bee8-dd74759d96c9%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 31, 2014, 9:21pm UTC](https://discuss.elastic.co/t/disabling-number-detection-in-dynamic-mapping/15539/2 "2014-01-31T21:21:35Z")

</div>

Hi Andra

You need to index `info` as a string:

{ "info": "232-433-5425"}

If numeric\_detection is set to true, then it will try to find strings that  
look like numbers. It doesn't have any effect on fields indexed as numbers.

clint

On 31 January 2014 22:09, Andra Bennett [andrucu@gmail.com](mailto:andrucu@gmail.com) wrote:

> Hi,
> 
> I'm using elasticsearch 0.90.9 as an embedded node and have problems with  
> numeric\_detection of data in a dynamically-mapped type.
> 
> I'd like to index data with dynamic mapping, however I'm hitting a  
> MapperParsingExeption due to attempting to parse a string as a number.  
> I understand types are propagated to other elements based on the type  
> assignment of the first instance. So for input data below I think I need to  
> disable number\_detection on the index.
> 
> contact :{ info: { 232-433-5435 }, info: { [email@email.com](mailto:email@email.com) } }
> 
> So I tried specifically setting the numeric\_detection on the index to  
> false
> 
> client.admin().indices().prepareCreate(indexName).addMapping(type,  
> jsonMapping).execute().actionGet();
> 
> The mapping for that type doesn't look right:  
> {"requests":{"properties":{}}}
> 
> Here is how I get the type mapping in the Java API  
> ClusterState cs = client.admin().cluster().prepareState().setFilterIndices  
> (indexName).execute().actionGet().getState();  
> IndexMetaData imd = cs.getMetaData().index(indexName);  
> MappingMetaData mdd = imd.mapping(typeName);  
> mdd.source().string())
> 
> Furthermore, I get the same exception upon  
> indexing MapperParsingException:
> 
> failed to parse [contact.info] .... Caused by:  
> java.lang.NumberFormatException: For input string: "foobar"
> 
> Is the numeric\_detection field the problem in this setting? How else can  
> it be accessed from the Java API?
> 
> Thanks!
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/9253ee13-44d6-4513-bee8-dd74759d96c9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9253ee13-44d6-4513-bee8-dd74759d96c9%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPt3XKRQp-VrNWrAohFWVBnbM8ZToopw5xadxOcQvHTAHGnYsQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKRQp-VrNWrAohFWVBnbM8ZToopw5xadxOcQvHTAHGnYsQ%40mail.gmail.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, 1:53am UTC](https://discuss.elastic.co/t/disabling-number-detection-in-dynamic-mapping/15539/3 "2017-07-06T01:53:32Z")

</div>

Closed on July 6, 2017, 1:53am UTC


