繁体   English   中英

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

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

我是弹性搜索的新手,我想更新索引下的现有映射。 我现有的映射看起来像

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

我想从映射中更新该字段以进行分析,以便可以搜索“ customerReferenceNumber”字段。 我正在尝试在Sense插件中运行以下查询,

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

但是我在此命令中遇到以下错误,MergeMappingException [由于失败而失败合并[[mapper customerReferenceNumbers]具有不同的索引值]

尽管存在与这些映射关联的数据,但在这里我无法理解为什么弹性搜索不允许我将映射从无索引更新为索引?

提前致谢!!

ElasticSearch不允许这种更改。

而且即使有可能,因为您将不得不重新索引数据才能使用新的映射,所以使用新映射创建新索引并将数据重新索引到其中的速度更快。

如果您无法承受任何停机时间,请查看为这些用例设计alias功能。

这是设计使然。 您不能以这种方式更改现有字段的映射。 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