24

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?

3 Answers 3

11

@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

Sign up to request clarification or add additional context in comments.

2 Comments

When I try what you have suggested, I get "{"error":"IndexAlreadyExistsException[[indexName] already exists]","status":400}". Any idea?
@KartikeyaSinha you probably try to create a new index with an already existing name.
7

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

Comments

1

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.

1 Comment

This fixed it for me on 1.7 as well. I had only one mapping in the config as above, but I was also setting the same one explicitly in the template parameter of the elasticsearch output in my logstash config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.