从示例JSON文件复制内容到索引ElasticSearch索引JSON文件

mv1qrgav  于 2023-04-20  发布在  ElasticSearch
关注(0)|答案(1)|浏览(133)

ElasticSearch版本我用6.6.1
我已经通过运行以下命令curl -XPUT http://localhost:9200/incident_422?-H 'Content-Type创建了索引:application/json' -d @elasticsearch.json
我需要用示例JSON数据更新索引文件。(sample.json)

{
    "properties": {
        "id185": {
            "type": "byte"
    },
    "id255": {
      "type": "text"
    },
    "id388": {
      "type": "text"
      }
    }
  }

我尝试运行命令curl -XPUT http://localhost:9200/incident_422/mapping/_doc?-H 'Content-Type:application/json' -d @sample.json
但是我得到错误消息说{“error”:{“root_cause”:[{“type”:“illegal_argument_exception”,“reason”:“Rejecting mapping update to [incident_422] as the final mapping would have more than 1 type:[mapping,doc]"}]
我在某个地方读到过ELK 6不支持两种以上的类型。
有没有人可以告诉我,如何才能做到这一点,而不降级的版本

nhhxz33t

nhhxz33t1#

这似乎与removal of mapping type有关,您需要在索引文档时指定类型名称。
尝试添加类型到您的索引请求aka http://localhost:9200/incident_422/<your-type-name>在您的URL,它应该解决这个问题。

相关问题