gpt4 book ai didi

elasticsearch - 在不同映射中具有相同名称的字段上的Elasticsearch(2.3.2) “not_analyzed”

转载 作者:行者123 更新时间:2023-12-03 01:00:30 26 4
gpt4 key购买 nike

如果执行以下操作,则会发生错误:

  • 创建具有两个映射的索引
  • 这两个映射具有相同的字段(在本例中为thing)
  • thing字段中只有一个具有"index": "not_analyzed"

  • 可以通过以下调用完成以上操作:
    DELETE /test/

    PUT /test/
    {
    "mappings": {
    "product": {
    "properties": {
    "thing": {
    "type": "string",
    "index": "not_analyzed"
    }
    }
    },
    "page": {
    "properties": {
    "thing": {
    "type": "string"
    }
    }
    }
    }
    }

    然后将发生以下错误:
    # DELETE /test/
    { ... }

    # PUT /test/
    {
    "error": {
    "root_cause": [
    {
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [page]: Mapper for [thing] conflicts with existing mapping in other types:\n[mapper [thing] has different [index] values, mapper [thing] has different [omit_norms] values, cannot change from disable to enabled, mapper [thing] has different [analyzer], mapper [thing] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
    }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [page]: Mapper for [thing] conflicts with existing mapping in other types:\n[mapper [thing] has different [index] values, mapper [thing] has different [omit_norms] values, cannot change from disable to enabled, mapper [thing] has different [analyzer], mapper [thing] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]",
    "caused_by": {
    "type": "illegal_argument_exception",
    "reason": "Mapper for [thing] conflicts with existing mapping in other types:\n[mapper [thing] has different [index] values, mapper [thing] has different [omit_norms] values, cannot change from disable to enabled, mapper [thing] has different [analyzer], mapper [thing] is used by multiple types. Set update_all_types to true to update [omit_norms] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_analyzer] across all types., mapper [thing] is used by multiple types. Set update_all_types to true to update [search_quote_analyzer] across all types.]"
    }
    },
    "status": 400
    }

    有人可以解释为什么会这样吗?这是一个错误吗?

    最佳答案

    flex “类型”机制是虚拟的。意思是,在较低级别(= lucene),索引的所有文档都是相同的“类型”。 flex “类型”划分仅通过添加“_type”字段并对其进行过滤来完成。这意味着您不能(在一个索引上)具有相同的field_name和不同的映射的2种类型-因为在较低级别上它们具有相同的类型并且彼此冲突!
    您在“产品”类型中将“事物”定义为not_analyzed,在“页面”中将其定义为“字符串”,默认为“已分析”-这是一种不同的映射,会发生冲突!使它们两者相同或更改字段名称之一。

    关于elasticsearch - 在不同映射中具有相同名称的字段上的Elasticsearch(2.3.2) “not_analyzed”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38438779/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com