Conflict in mapping

Hi,

I updated my mapping, adding a field "position (integer)" in type A while there was another field "position (float)" in type B. I had a message telling my about the conflict, so I created a new field. But now when I start elastic, I keep having the error message "Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [float], merged_type [integer]]"

The shards fail, I cannot access the data, how can I fix this ?

Thanks a lot
Jérémie

Which version of Elasticsearch are you running? Can you send the exact JSON of how you updated the mapping for type A?

If I understood correctly, you started Elasticsearch, updated the mapping to add "position" as an integer, got an error message so instead named the field something else (e.g. "position_int") which worked successfully, then you stopped Elasticsearch and when you restarted, you get the error you mentioned?

Yes, this is what happened.

I am running ES 2.1.1
I updated my (existing) mapping this way, to add the "position" field :

PUT /aaa/_mapping/typeA
{
  "properties": {
    "links": {
      "type": "nested",
      "properties": {
        "position": {
          "type":"integer"
        }
      }
    }
  }
}

Was this your question ?

Thanks
Jérémie

Hi Jérémie,

I tried the same thing on 2.1.1 and I had no issues restarting Elasticsearch. I first set typeA's mapping with position as a float, then set typeB's mapping with position as an integer (exactly the JSON you sent), I also received the same error about mapping, so I created typeB's mapping with position as a float, which succeeded. I then proceeded to restart Elastic and it restarted with no issues and I was able to execute requests.

Can you send over your logs? Is there something else causing the restart issue?

Are you able to reproduce this with a new 2.1.1 install?

Hi,

The logs tell me this :
[2016-02-08 10:34:44,385][WARN ][cluster.action.shard ] [node-jeremie] [aaa][4] received shard failed for [aaa][4], node[r6Ld3r26SSKOxVgEZM6fLw], [P], v[1419], s[INITIALIZING], a[id=I43r4iASS2eRU4ucA6NeTQ], unassigned_info[[reason=ALLOCATION_FAILED], at[2016-02-08T09:34:32.475Z], details[failed to update mappings, failure IllegalArgumentException[Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [integer], merged_type [float]]]]], indexUUID [cMsFDFiHTAaDonHsAp9cWg], message [failed to update mappings], failure [IllegalArgumentException[Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [integer], merged_type [float]]]] java.lang.IllegalArgumentException: Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [integer], merged_type [float]] at org.elasticsearch.index.mapper.MapperService.checkNewMappersCompatibility(MapperService.java:363) at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:319) at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:265) at org.elasticsearch.indices.cluster.IndicesClusterStateService.processMapping(IndicesClusterStateService.java:418) at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyMappings(IndicesClusterStateService.java:372) at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:177) at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:494) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231) at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) [2016-02-08 10:34:44,389][WARN ][cluster.action.shard ] [node-jeremie] [aaa][4] received shard failed for [aaa][4], node[r6Ld3r26SSKOxVgEZM6fLw], [P], v[1420], s[STARTED], a[id=I43r4iASS2eRU4ucA6NeTQ], indexUUID [cMsFDFiHTAaDonHsAp9cWg], message [master {node-jeremie}{r6Ld3r26SSKOxVgEZM6fLw}{127.0.0.1}{127.0.0.1:9300}{rack=office} marked shard as started, but shard has previous failed. resending shard failure.], failure [Unknown] [2016-02-08 10:34:44,391][WARN ][cluster.action.shard ] [node-jeremie] [aaa][2] received shard failed for [aaa][2], node[r6Ld3r26SSKOxVgEZM6fLw], [P], v[1438], s[INITIALIZING], a[id=mst-XH9VTrKYFTBxocitTA], unassigned_info[[reason=ALLOCATION_FAILED], at[2016-02-08T09:34:32.475Z], details[failed to update mappings, failure IllegalArgumentException[Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [integer], merged_type [float]]]]], indexUUID [cMsFDFiHTAaDonHsAp9cWg], message [master {node-jeremie}{r6Ld3r26SSKOxVgEZM6fLw}{127.0.0.1}{127.0.0.1:9300}{rack=office} marked shard as initializing, but shard is marked as failed, resend shard failure], failure [Unknown] [2016-02-08 10:34:44,397][WARN ][cluster.action.shard ] [node-jeremie] [aaa][3] received shard failed for [aaa][3], node[r6Ld3r26SSKOxVgEZM6fLw], [P], v[1249], s[INITIALIZING], a[id=4xBoUFHZTYa1uW561-c8HA], unassigned_info[[reason=ALLOCATION_FAILED], at[2016-02-08T09:34:32.475Z], details[failed to update mappings, failure IllegalArgumentException[Mapper for [links] conflicts with existing mapping in other types[mapper [links.position] of different type, current_type [integer], merged_type [float]]]]], indexUUID [cMsFDFiHTAaDonHsAp9cWg], message [master {node-jeremie}{r6Ld3r26SSKOxVgEZM6fLw}{127.0.0.1}{127.0.0.1:9300}{rack=office} marked shard as initializing, but shard is marked as failed, resend shard failure], failure [Unknown]

I cannot request data on the index, because shards are almost always unavailable. But I can request the mapping, and I can see it is wrong, because, there are the integer position field, and the integer contentPosition field (to be used instead of the first "position").

Is it normal elastic saved the conflicted mapping ?

This is a known issue in 2.1.1 (and 2.1.2). It has been fixed in 2.2.0: https://www.elastic.co/guide/en/elasticsearch/reference/current/release-notes-2.2.0.html#bug-2.2.0