尝试在我的代码中设置user.keyword,但给出了Elasticsearch的错误

发布于 2025-01-21 10:35:43 字数 870 浏览 4 评论 0原文

我试图将其添加

"field": "participant-id.keyword",

到我的文档中,

{
   "event": {
      "properties": {
        "participant-id": {
          "type": "text",
          "fields":{
            "keyword":{
              "type": "keyword",
              "field": "participant-id.keyword",
              "ignore_above": 256
            }
          }
        }
      }
   }
}

这给了我这个错误,我相信我在错误的行中添加了.keyword

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [fields] has unsupported parameters:  [field : participant-id.keyword]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Mapping definition for [fields] has unsupported parameters:  [field : participant-id.keyword]"
  },
  "status": 400
}

i tried to add this

"field": "participant-id.keyword",

to my document

{
   "event": {
      "properties": {
        "participant-id": {
          "type": "text",
          "fields":{
            "keyword":{
              "type": "keyword",
              "field": "participant-id.keyword",
              "ignore_above": 256
            }
          }
        }
      }
   }
}

It gave me this error , I believe i added .keyword in wrong line

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [fields] has unsupported parameters:  [field : participant-id.keyword]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Mapping definition for [fields] has unsupported parameters:  [field : participant-id.keyword]"
  },
  "status": 400
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无妨# 2025-01-28 10:35:43

“字段”不是“字段”中的预定参数>参与者-ID.KeyWord 自动为您而言,您无需自己定义它。
所以应该这样的事情:

{
   "event": {
      "properties": {
        "participant-id": {
          "type": "text",
          "fields":{
            "keyword":{
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
   }
}

"field" is not a predefined parameter in "fields" so it throws an error and can't be used there, and I don't see any necessity to use that because when you add a keyword type to a field it creates participant-id.keyword automatically for you and you don't need to define it by yourself.
so it should be something like this:

{
   "event": {
      "properties": {
        "participant-id": {
          "type": "text",
          "fields":{
            "keyword":{
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文