前言 : 今天接到一个ES分页统计查询的需求,以前也没接触过,在实现过程中也是各种度娘,借此机会记录以及学习,如有更好的解决方案或不对的地方请指正
借鉴地址 :
https://blog.csdn.net/topdandan/article/details/81436141
https://blog.csdn.net/Prepared/article/details/85165140
如有侵权请联系博主
1.类似实现的SQL
SELECT user_id,count( user_id ) AS countA FROM test_table WHERE phone_no IN ( '123', '321' ) GROUP BY user_id ORDER BY countA DESC LIMIT 0,5
2. 实体
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* @Date: 2020/2/3 14:06
* @Description:
*/
@Data
@