带有一些元数据的elasticsearch响应_source

时间:2018-10-16 04:40:44

标签: elasticsearch kibana

我只想获得我感兴趣的数据,没有除scroll_id之外的元数据,

我发现的问题很少,有些是4年前的,当时还不可能

我发现“ filter_path”应该可以工作,但是响应仍然具有“ hits”属性

我需要它来进行POST请求,但找不到该属性。

夏天:我只想返回scroll_id和_source的数组

常规响应示例:

        {
 "_scroll_id": "xx...",
      "took": 8,
      "timed_out": false,
      "_shards": {
        "total": 10,
        "successful": 10,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": 4,
        "max_score": null,
        "hits": [
          {
            "_index": "test",
            "_type": "queryBuilder",
            "_id": "t-fod2YBqV5yz7ZcVqaD",
            "_score": null,
            "_source": {
              "TimeTag": 2,
              "water": 9
            },
            "sort": [
              2
            ]
          },
          {
            "_index": "test",
            "_type": "queryBuilder",
            "_id": "uOfod2YBqV5yz7ZccqY2",
            "_score": null,
            "_source": {
              "TimeTag": 3,
              "water": 11
            },
            "sort": [
              3
            ]
          }

添加filter_path = hits.hits._source 后的响应

   {
      "hits": {
        "hits": [
          {
        "_source": {
          "TimeTag": 2,
          "water": 9
        }
      },
      {
        "_source": {
          "TimeTag": 3,
          "water": 11
        }
      },

        ]
      }
    }


**the response I need:**

    {
    "_scroll_id": "xx...",
    _source:[
     {
      "TimeTag": 2,
      "water": 9
     },
     {
      "TimeTag": 3,
      "water": 11
     }
    ]
}

谢谢

0 个答案:

没有答案