我有文件:通过entity_type和field_name字段获取

我有文件:

{
    "_index" : "logs",
    "_id" : "e174f29c-9f0b-4aab-a3b3-7ab5dcb8a50a",
    "_score" : null,
    "_source" : {
      "number" : 1,
      "request_type" : 1,
      "request_entity_type" : 1,
      "entity_type" : 1,
      "entity_id" : "6c125004-4720-4258-a5d6-3fa1c7468bc8",
      "field_name" : "name",
      "old_value" : null,
      "new_value" : """[{"locale":"ru-RU","text_value":"1234"}]""",
      "created_by" : "b6aa1f8f-79b8-45b6-a11c-fe65b8bdfc35",
      "created_at" : "2022-06-29T10:47:43.205753"
    }
  }

当我尝试通过entity_type 和field_name 字段获取此文档时,它可以工作:

GET logs/_search
{
  "query": {
    "bool": {
      "filter": [
          {"term" : { "entity_type" : "1" }},
          {"term": {"field_name": "name"}}
      ]
    }
  },
  "sort": [
    {
      "number": {
        "order": "desc"
      }
    }
  ]
}

但是当我将 field_name 更改为 entity_id 时,我得到零点击:

GET logs/_search
{
  "query": {
    "bool": {
      "filter": [
          {"term" : { "entity_type" : "1" }},
          {"term": {"entity_id": "6c125004-4720-4258-a5d6-3fa1c7468bc8"}}
      ]
    }
  },
  "sort": [
    {
      "number": {
        "order": "desc"
      }
    }
  ]
}

为什么它不起作用? field_name和entity_id有什么区别

© 版权声明
THE END
喜欢就支持一下吧
点赞235 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片