elasticsearch Elasticsearch 7.10不接受关键字?,elasticsearch,curl,elasticsearch,Curl" /> elasticsearch Elasticsearch 7.10不接受关键字?,elasticsearch,curl,elasticsearch,Curl" />

elasticsearch Elasticsearch 7.10不接受关键字?

elasticsearch Elasticsearch 7.10不接受关键字?,elasticsearch,curl,elasticsearch,Curl,我有一个全新的Elasticsearch 7.10,具有以下映射 "log": { "mappings": { "properties": { "Subject": { "type": "text" }, "code": { "type&

我有一个全新的Elasticsearch 7.10,具有以下映射

  "log": {
    "mappings": {
      "properties": {
        "Subject": {
          "type": "text"
        },
        "code": {
          "type": "keyword"
        },
        "host_message": {
          "type": "text"
        },
        "hostname": {
          "type": "keyword"
        },
        "message_id": {
          "type": "keyword"
        },
        "remote": {
          "type": "keyword"
        },
        "sender": {
          "type": "keyword"
        },
        "server": {
          "type": "keyword"
        },
        "status": {
          "type": "keyword"
        },
        "ts": {
          "type": "date"
        }
      }
    }
  }
}
现在我只想索引一个文档

curl -k -uelastic:secret -H "Content-Type: application/json" -XPUT https://172.16.11.11:9200/log/info/B8DF712CEE -d ' {"ts": "1604790002000",
   "Subject": "random text",
   "message_id": "B8DF712CEE",
   "receiver": "root@localhost",
   "sender": "None",
   "code": "ok",
   "host_message": "(delivered to mailbox)",
   "hostname": "localhost",
   "dsn": "2.0.0",
   "status": "sent",
   "remote": ""}
'

这给了我一个非法的例外

这几乎适用于以前的所有版本。 我搜索了互联网,但什么也没找到。我甚至没有意识到在放置时文本和关键字之间存在差异


我将尝试将我的映射更改为多字段,但非常感谢提供任何信息。

当您在Elasticsearch 7.10中创建索引并放置映射时,您不会声明“类型”,并且它会在索引中自动设置为“\u doc”。因此,您需要将您的url更改为

https://172.16.11.11:9200/log/_doc/B8DF712CEE

我想你需要换成手术后


希望能奏效。

您需要将URL中的
信息替换为
\u doc
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [remote] cannot be changed from type [keyword] to [text]"}],"type":"illegal_argument_exception","reason":"mapper [remote] cannot be changed from type [keyword] to [text]"},"status":400}