设置参数 `node.name` 可以自定义 Elasticsearch 节点的名字。 此条 Tips 由 medcl 贡献。

ES:怎么在group by统计总数后返回多字段信息

Elasticsearch | 作者 张鹏 | 发布于2018年01月29日 | 阅读数:10352

select fcmp_cap_id,fcap_time,fcmp_cap_channel,person_id,fcmp_socre,template_id,fea_id,count(0) group by id_numb ;
以下是es中的一条数据,怎么才能使用java api 得到以上sql的结果{"_index": "person",
"_type": "ptype",
"_id": "6",
"_version": 1,
"_score": 1,
"_source": {

"fcmp_cap_id": "1",
"fcap_time": 1516871040,
"fcmp_cap_channel": "1",
"person_id": "2537de94-f2c2-11e7-9962-000c2970859b",
"fcmp_socre": 90,
"id_numb": "411402",
"template_id": "1",
"fea_id": "1"

}}
 
 
已邀请:

rockybean - Elastic Certified Engineer, ElasticStack Fans,公众号:ElasticTalk

赞同来自:

结合 top_hits  取第一条文档

张鹏

赞同来自:

SearchHits hits = response.getHits(); 
Terms agg = response.getAggregations().get("agg");
 
 
hits 和agg的个数不一致的时候,怎么保持数据同步啊,遇到这个问题了没
 

要回复问题请先登录注册