2016-03-21 38 views
8

我想向我的映射添加一些额外的属性,在这种特定情况下,我想修改英文索引中的标题字段,以便它使用英文分析器。在ElasticSearch上设置update_all_types为true

应该是非常简单的,除了我在某些类型的标题字段,并且它似乎是不可能做到这一点。

我的错误是:设置update_all_types为true,在所有类型的更新[search_quote_analyzer]

但我无法找到如何或在哪里设置这个“update_all_types”一个单一的参考。参数。

这是非常简单的代码我在使用感:

PUT /my_index/_mapping/my_type 
    { 
     "properties": { 
     "title": { 
      "type": "string", 
      "analyzer": "english" 
     } 
     } 
    } 

所以,我怎样才能使这项工作,如果同一领域中其他类型的使用?

这是错误消息:

"type": "illegal_argument_exception", 
"reason": "Mapper for [title] conflicts with existing mapping in other types: 
    [mapper [title] has different [analyzer], mapper [title] is used by 
    multiple types. Set update_all_types to true to update [search_analyzer] 
    across all types., mapper [title] is used by multiple types. Set 
    update_all_types to true to update [search_quote_analyzer] across 
    all types.]" 

所以看起来我需要设置“update_all_types:真正的”某处,但该部分的文档失败。

+0

文档,您将登陆[正确的页面](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-put-mapping.html#merging-conflicts);-) – Val

+0

Ouch ,似乎我忽略了那一个。 无论如何,似乎没有工作,因为现在我得到一个不同的错误,我会更新原来的文章 – Wokoman

+0

最有可能的是,你的另一种类型的字段'标题'已经有不同的分析器(即不同类型为'my_type'的'title'分析器)。可能?你可以显示'GET my_index'的输出吗? – Val

回答

6

你可以找到文档here

update_all_types是一个GET参数给这样的: PUT my_index/_mapping/type_one?update_all_types

1

我也有类似的问题,请尝试下面的代码更新所有的类型:如果您在使用搜索功能

PUT /my_index/_mapping/my_type?update_all_types 
    { 
     "properties": { 
     "title": { 
      "type": "string", 
      "analyzer": "english" 
     } 
     } 
    } 
相关问题