Elasticsearch 对象映射试图将字段 [null] 解析为对象,但找到了一个具体值

Elasticsearch object mapping for tried to parse field [null] as object, but found a concrete value

如何使用 AWS 上的 elasticsearch 更改映射或我的输入来解决这些错误,

映射:

    {
        "index_patterns": ["*-students-log"],
        "mappings": {
            "properties": {
                "Data": {
                    "type": "object",
                    "properties": {
                        "PASSED": {
                            "type": "object"
                        }
                    }
                },
                "insertion_timestamp": {
                    "type": "date",
                    "format": "epoch_second"
                }
            }
        }
    }

我的数据:

    curl -XPOST -H 'Content-Type: application/json' https://******.us-east-1.es.amazonaws.com/index_name/_doc/1 -d '{"Data": {"PASSED": ["Vivek"]},"insertion_timestamp": 1591962493}'

我得到的错误:

    {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"object mapping for [Data.PASSED] tried to parse field [null] as object, but found a concrete value"}],"type":"mapper_parsing_exception","reason":"object mapping for [Data.PASSED] tried to parse field [null] as object, but found a concrete value"},"status":400}

以上数据中遗漏或错误的部分是什么?我应该将任何其他数据类型用于字符串数组吗? 任何帮助将不胜感激...

JSON 数组 JSON objects 当被引入 Elasticsearch 时。

有关 arrays 的文档说明如下:

There is no dedicated array datatype. Any field can contain zero or more values by default, however, all values in the array must be of the same datatype.

因此,与其将整个数组声明为 object,不如直接指定数组条目的数据类型 (text):

PUT abc-students-log
{
  "mappings": {
    "properties": {
      "Data": {
        "type": "object",
        "properties": {
          "PASSED": {
            "type": "text"   
          }
        }
      },
      "insertion_timestamp": {
        "type": "date",
        "format": "epoch_second"
      }
    }
  }
}
POST abc-students-log/_doc
{
  "Data": {
    "PASSED": [
      "Vivek"
    ]
  },
  "insertion_timestamp": 1591962493
}