刚学习 es,这个问题困扰了我很久。。求大佬救救我 查询语句
{
"query": {
"term": {
"memberid": "2136476"
}
},
"aggs": {
"group": {
"terms": {
"field": "meetingid",
"order": {
"addtime": "desc"
}
},
"aggs": {
"result": {
"top_hits": {
"_source": [
"meetingid",
"memo",
"addtime"
],
"size": 1,
"sort": {
"addtime": {
"order": "desc"
}
}
}
},
"addtime": {
"max": {
"field": "addtime"
}
}
}
}
}
}
我想要获取_source 的值
最后获取到这一步后卡住了,debug 了一下发现有一个 SearchHit 的值,但我用 getProperty()获取不到,求解答
SearchResponse response = client.search(request).actionGet();
Aggregations aggregations = response.getAggregations();
Aggregation a = aggregations.get("meeting");
Terms teamSum= (Terms)a;
for(Terms.Bucket bucket:teamSum.getBuckets()){
Aggregation aggregation = bucket.getAggregations().get("result");
}