将源字段添加到Elasticsearch查询?

时间:2017-05-16 12:48:02

标签: elasticsearch

我有这个查询正在点击下表。如何向其添加源字段以从此索引的_source字段返回特定列?

获取mktg_percolate_postmetrics_mib / _search

{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "end_date": {
              "gte": "now-30d",
              "lte": "now",
              "format": "epoch_millis"
            }
          }
        }
      ]
    }
  },
  "size": 0,
  "aggs": {
    "2": {
      "terms": {
        "field": "post_id",
        "size": 25,
        "order": {
          "1": "desc"
        }
      },
      "aggs": {
        "1": {
          "sum": {
            "script": "doc['facebook_likes'].value + doc['facebook_shares'].value + doc['facebook_comments'].value + doc['facebook_post_consumptions_by_type_link_clicks'].value",
            "lang": "expression"
          }
        }
      }
    }
  }
}

0 个答案:

没有答案