elasticsearch - 更新关键字字段的ignore_above

标签 elasticsearch

现有映射:

"call": {
      "type": "text",
      "norms": false,
      "fields": {
        "keyword": {
          "type": "keyword",
          "ignore_above": 256
        }
      }
    }

更新:
PUT myIndex/_mapping
{
    "properties": {
      "call": {
        "type": "text",
        "fields": {
          "keyword":{
            "type": "keyword",
            "ignore_above": 500
          }
        }
      }
    }
  }

我得到这个错误:
  {
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Mapper for [call] conflicts with existing mapping:\n[mapper [call] has different [norms] values, cannot change from disable to enabled]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Mapper for [call] conflicts with existing mapping:\n[mapper [call] has different [norms] values, cannot change from disable to enabled]"
  },
  "status": 400
}

我做错了什么?

最佳答案

您还必须在更新中包括“规范”属性。您已在原始映射中将其设置为false。忽略它会导致Elasticsearch尝试将其设置为默认值,这是正确的。禁用后无法启用规范字段。如果需要,您必须创建一个新索引。

这是正确的更新:

PUT myIndex/_mapping
{
    "properties": {
      "call": {
        "type": "text",
        "norms": false,
        "fields": {
          "keyword":{
            "type": "keyword",
            "ignore_above": 500
          }
        }
      }
    }
  }

关于elasticsearch - 更新关键字字段的ignore_above,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56687878/

相关文章:

java - 如何在 ElasticSearch 中使用带通配符的术语?

elasticsearch - 关于Elasticsearch集群

azure - 如何连接到Azure上安装的多个节点的elasticsearch集群?如何获取elasticsearch端点?

Elasticsearch + Apache Spark 性能

elasticsearch - Elasticsearch Sink Connector 是否像 JDBC sink 连接器一样支持主键上的 upsert 模式?

elasticsearch - 无法在LXC上更改vm.max_map_count

macos - 批量创建时的 Elasticsearch 异常

elasticsearch - 解析多行日志时,logstash配置出现问题

elasticsearch - Elasticsearch hits.total与OR不同

java - 如何通知 Elasticsearch 客户端有新的索引文档?