Disabling number_detection in dynamic mapping?


(Andra Bennett) #1

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 } }

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.
To view this discussion on the web visit 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.


(Clinton Gormley) #2

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 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 } }

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.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPt3XKRQp-VrNWrAohFWVBnbM8ZToopw5xadxOcQvHTAHGnYsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3