【问题标题】:Elastic Search : Update mapping of one field in existing index弹性搜索:更新现有索引中一个字段的映射
【发布时间】:2019-11-04 19:25:57
【问题描述】:

我有一个具有以下映射的索引:

{
          "code_sourcenodedupefilecontractv4_1421_shared_5dd3788f-2d0a-4a49-b679-98bbf519013e": {
            "mappings": {
              "SourceNoDedupeFileContractV4": {
                "_meta": {
                  "version": 1421
                },
                "_routing": {
                  "required": true
                },
                "properties": {

                  .
                  .
                  .
                  .

                  "indexedTimeStamp": {
                    "type": "date",
                    "store": true,
                    "doc_values": false,
                    "format": "epoch_second"
                  },
                  .
                  .
                  .
                  .
                  .

                }
              }
            }
          }
        }

我必须将字段 doc_value 更改为 true。我已经尝试过以下但在尝试时遇到异常。

PUT code_sourcenodedupefilecontractv4_1421_shared_5dd3788f-2d0a-4a49-b679-98bbf519013e/_mapping/SourceNoDedupeFileContractV4
{
  "properties": {
    "indexedTimeStamp": {
      "type": "date",
      "doc_values" : true
    }
  }
}

我得到的例外是在尝试命令时:

    {
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Mapper for [indexedTimeStamp] conflicts with existing mapping in other types:\n[mapper [indexedTimeStamp] has different [store] values, mapper [indexedTimeStamp] has different [doc_values] values, mapper [indexedTimeStamp] has different [format] values]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Mapper for [indexedTimeStamp] conflicts with existing mapping in other types:\n[mapper [indexedTimeStamp] has different [store] values, mapper [indexedTimeStamp] has different [doc_values] values, mapper [indexedTimeStamp] has different [format] values]"
  },
  "status": 400
}

知道我在这里做错了什么吗?任何帮助将非常感激。

【问题讨论】:

    标签: elasticsearch kibana


    【解决方案1】:

    doc_values无法更新。

    您将不得不删除您的索引更新您的映射并重新索引您的数据。

    见我的answer about reindexing

    【讨论】:

    • 我也试过没有字段。还是同样的错误。 [也更新了问题。]
    • 您是要更新映射还是创建新映射?删除 doc_value
    • 不,我正在尝试更新它的值。准确地说,想将其设置为 true。
    • 好的,现在我知道这里发生了什么。在您的更新映射查询中,将 indexedTimeStamp 更改为 SourceNoDedupeFileContractV4 并删除 doc_value 属性,因为它在字段中不受支持。
    • 我已经更新了这个问题。这一次,其他一些错误。尽管如此,还是感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-20
    相关资源
    最近更新 更多