gpt4 book ai didi

elasticsearch - 无法在Elasticsearch中更新映射

转载 作者:行者123 更新时间:2023-12-02 22:28:12 27 4
gpt4 key购买 nike

当使用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/

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