Elasticsearch 6: Rejecting mapping update as the final mapping would have more than 1 type

后端 未结 5 1916
忘了有多久
忘了有多久 2021-02-18 19:29

I\'m trying to convert a project to use the latest Elasticsearch 6 and am having this problem. I don\'t know if the problem is \"Product\" vs \"product\". In my mappings and att

相关标签:
5条回答
  • 2021-02-18 20:04

    I deleted the index and recreated it and it appears to be fine now. I think when I first created the index I didn't have the correct attribute name so that might explain the error I was getting.

    0 讨论(0)
  • 2021-02-18 20:09

    Prior to elasticsearch v6, an index can have only 1 mapping by default. In previous version 5.x, multiple mapping was possible for an index. Though you may change this default setting by updating index setting "index.mapping.single_type": false .

    In your case, my assumption is you had already created the index with mapping Product. That is why it was rejecting new mapping in your second request with "product" (p in small case).

    0 讨论(0)
  • 2021-02-18 20:11

    In my case I was trying to delete a record following the official docs and I blindly put the _doc in the URL which led to this error.

    This should be the mapping that you see under the Indices tab against Mappings section in the AWS console. changing the value in the URL solved it for me.

    Hope this was helpful :)

    0 讨论(0)
  • 2021-02-18 20:21

    As Batsu says, from version 5 of elasticSearch onwards, the concept of treating the index as the database and the type as a table was removed to implement a lucene optimization.

    The solution is to use an index by @Document.

    Referral: https://www.elastic.co/guide/en/elasticsearch/reference/6.7/removal-of-types.html

    0 讨论(0)
  • 2021-02-18 20:22

    This is because of a breaking change in ES 6.x: mapping types were removed (even if for backward compatibility you can still specify it in the path) thus de facto limiting the index to a single type.

    See here for more info.

    0 讨论(0)
提交回复
热议问题