elasticsearch - 无法在Elasticsearch中更新映射

标签 elasticsearch

当使用anaylzerPUT /job/_mapping/doc/放入映射时,却发生冲突。
但是映射中没有anaylzer

PUT /job/_mapping/doc/
{
    "properties":{
        "title": {
            "type": "text",
            "analyzer":"ik_smart",
            "search_analyzer":"ik_smart"
        }
    }
}
{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Mapper for [title] conflicts with existing mapping in other types:\n[mapper [title] has different [analyzer]]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Mapper for [title] conflicts with existing mapping in other types:\n[mapper [title] has different [analyzer]]"
    },
    "status": 400
}
                    "title": {
                        "type": "text",
                        "fields": {
                            "keyword": {
                                "type": "keyword",
                                "ignore_above": 256
                            }
                        },
                        "fielddata": true
                    },
输出配置是这样的。
output {
  elasticsearch {
    hosts => ["<Elasticsearch Hosts>"]
    user => "<user>"
    password => "<password>"
    index => "<table>"
    document_id => "%{<MySQL_PRIMARY_KEY>}"
  }
}

最佳答案

您无法在elasticsearch中更新映射,可以添加映射,但不能更新映射。 Elasticsearch在索引编制时使用映射,这就是为什么您无法更新现有字段的映射的原因。 Analyzer是映射的一部分,实际上,如果您未指定默认值,则Analyzer会告诉Elastic如何索引文档。

  • 使用您的新映射(包括分析器)创建新索引
  • 将您的文档从现有索引重新索引到新索引(https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)
  • 关于elasticsearch - 无法在Elasticsearch中更新映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55028438/

    相关文章:

    elasticsearch - 从汇总中排除文档

    Elasticsearch 通过嵌套查询提高分数

    elasticsearch - Searchkick嵌套数据

    elasticsearch - Elasticsearch:无法从关键字字段获取结果

    elasticsearch - 使用模板通过 Helm 定义子图表值

    Elasticsearch 简单查询字符串查询与精确文本搜索

    search - ElasticSearch中没有关联文档的构面

    ruby-on-rails - 使用搜索评分来确定 Controller 行为(轮胎/ Elasticsearch )

    elasticsearch - elasticsearch-获得 'function_score'内的中级分数

    elasticsearch - 无法将自定义字段添加到“Y轴平均”聚合以进行可视化