After updating to Elasticsearch 1.2.1
I keep getting the following exception on the following mapping:
{ "tags": { "properties": { "tags": { "type": "string", "index": "not_analyzed" } } } }
This is the exception:
Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type mapping not empty after parsing! Remaining fields: [tags : {properties={tags={index=not_analyzed, type=string}}}] at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:265) at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:189) at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:387) at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:253) at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:363)
Why is that?
@Mark this appears to be a bug in 1.2.X. There have been multiple others that have reported similar issues, I'll link to the tickets below. Basically it appears that they tightened up on syntax for mappings in 1.2.X but they appear to have caused some problems with previously valid mappings. Yours is one example.
I'd suggest you open a bug report - more power in numbers. Happy to chime in saying "me too" if you open a ticket, as I've recreated the problem on 1.2.1 .
For now I've been able to the following to work which I believe gives you the same desired result:
curl -XPUT localhost:9200/yourindexname -d '{ "mappings": { "tags": { "properties": { "tags": { "type":"string", "index":"not_analyzed" } } } } }'
Tickets:
https://github.com/elasticsearch/elasticsearch/issues/6414
https://github.com/elasticsearch/elasticsearch/issues/6304
https://github.com/elasticsearch/elasticsearch/issues/6415
This will help you
you will get want you want to do
curl -XPUT localhost:9200/new_index -d ' { "mappings": { "tags": { "properties": { "tags": { "type":"string", "index":"not_analyzed" } } } } }'
or you can also do this way
curl -XPUT localhost:9200/new_index/new_index_type/_mappings -d ' { "new_index_type": { "properties": { "tags": { "type": "string", "index": "not_analyzed" } } } }'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With