其他分享
首页 > 其他分享> > es聚合结果返回所有字段

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"
          }
        }
      }
    }
  }
}

标签:返回,adoptCount,topHitCategory,terms,aggregations,field,聚合,es,size
来源: https://blog.csdn.net/qq_35249342/article/details/119325058