简体   繁体   English

如何设置现有的弹性搜索映射,从索引:否到索引:已分析

[英]How to set existing elastic search mapping from index: no to index: analyzed

I am new to elastic search, I want to updated the existing mapping under my index. 我是弹性搜索的新手,我想更新索引下的现有映射。 My existing mapping looks like 我现有的映射看起来像

"load":{
    "mappings": {
        "load": {
            "properties":{
                "customerReferenceNumbers": {
                   "type": "string",
                   "index": "no"
                }
             }
         }
     } 
 }

I would like to update this field from my mapping to be analyzed, so that my 'customerReferenceNumber' field will be available for search. 我想从映射中更新该字段以进行分析,以便可以搜索“ customerReferenceNumber”字段。 I am trying to run the following query in Sense plugin to do so, 我正在尝试在Sense插件中运行以下查询,

PUT /load/load/_mapping { "load": {
    "properties": {    
        "customerReferenceNumbers": {
            "type": "string",
            "index": "analyzed"
           }
    }
}}

but I am getting following error with this command, MergeMappingException[Merge failed with failures {[mapper customerReferenceNumbers] has different index values] 但是我在此命令中遇到以下错误,MergeMappingException [由于失败而失败合并[[mapper customerReferenceNumbers]具有不同的索引值]

Though there exist data associated with these mappings, here I am unable to understand why elastic search not allowing me to update mapping from no-index to indexed? 尽管存在与这些映射关联的数据,但在这里我无法理解为什么弹性搜索不允许我将映射从无索引更新为索引?

Thanks in advance!! 提前致谢!!

ElasticSearch doesn't allow this kind of change. ElasticSearch不允许这种更改。

And even if it was possible, as you will have to reindex your data for your new mapping to be used, it is faster for you to create a new index with the new mapping, and reindex your data into it. 而且即使有可能,因为您将不得不重新索引数据才能使用新的映射,所以使用新映射创建新索引并将数据重新索引到其中的速度更快。

If you can't afford any downtime, take a look at the alias feature which is designed for these use cases . 如果您无法承受任何停机时间,请查看为这些用例设计alias功能。

This is by design. 这是设计使然。 You cannot change the mapping of an existing field in this way. 您不能以这种方式更改现有字段的映射。 Read more about this at https://www.elastic.co/blog/changing-mapping-with-zero-downtime and https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html . https://www.elastic.co/blog/changing-mapping-with-zero-downtimehttps://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put上了解有关此内容的更多信息-mapping.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM