Reputation: 69920
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?
Upvotes: 24
Views: 20041
Reputation: 1017
I had the same problem because I had mappings with same type in the elastic config/mappings
directory.
Removing the mapping file solded my problem.
Upvotes: 1
Reputation: 871
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"
}
}
}
}'
Upvotes: 7
Reputation: 27487
@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
Upvotes: 11