es聚合结果返回所有字段

使用topHit aggregation

{
  "size": 0,
  "query": {
    "match_all": {}
  },
  "aggregations": {
    "questionAgg": {
      "terms": {
        "field": "faqQuestion",
        "size": 100
      },
      "aggregations": {
        "faqFeedbackAgg": {
          "terms": {
            "field": "feedback",
            "size": 2
          }
        },
        "topHitCategory": {
          "top_hits": {
            "from": 0,
            "size": 1
          }
        },
        "faqMatchLevelAgg": {
          "terms": {
            "field": "faqMatchLevel",
            "size": 3
          }
        },
        "adoptCount": {
          "cardinality": {
            "field": "faqRelateId"
          }
        }
      }
    }
  }
}
上一篇:Android studio 工具栏不见了,怎么找回来


下一篇:ES代码