es实体类:
public class ChemicalES {
@IndexId(type = IdType.CUSTOMIZE)
private Long id;
@HighLight
@IndexField(fieldType = FieldType.TEXT, analyzer = "ik_max_word")
private String name;
@IndexField(fieldType = FieldType.KEYWORD)
private List<String> productTags;
}
存入es中的查询结构:
现在希望对字段 productTags 进行聚合,想要聚合后结构如下:
[
{key:'化肥',value:2},
{key:'农药',value:1},
{key:'尿素',value:2},
]