功能:使用es的聚合做去重查询类似mysql的group by 的使用
比如:我想在es中查询数据通过一个属性字段分组
SearchRequestBuilder sbuilder = client.prepareSearch("test").setTypes("tt");
TermsAggregationBuilder tab= AggregationBuilders.terms("id_count ").field("id");
sbuilder.addAggregation(tab);
SearchResponse response = sbuilder.execute().actionGet();
但是报错了:
Caused by: NotSerializableExceptionWrapper[: Fielddata is disabled on text fields by default. Set fielddata=true on [id] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.