ES
文章平均质量分 59
Es学习笔记
liaofucheng123
Java
展开
-
ES nested 一对多 聚合分组统计、bucket_script脚本
1.类似sqlselect sum(item.paymentAmount) from order_main mainleft join order_item item on main.id = item.main_idwhere item.sku in (100000047)group by orderItemList.cityName2.es queryDSL按理说子项一般不会用于存地址。但是使用主表的字段进行 group by main.cityName之后出不来数据。所以在子项进行了冗余字原创 2020-11-24 16:49:18 · 2950 阅读 · 0 评论 -
ES nested 聚合统计仅符合过滤的子项
ES nested 统计仅符合的子项相似SQLselect sum(item.sku_cnt) from table_main mainleft join table_item item on main.id = item.main_idwhere main.id in (4,5,6) and item.sku_id is not null;2.ES queryDSL查询{ "size": 0, "query": { "bool": {原创 2020-11-13 09:53:04 · 2113 阅读 · 0 评论 -
ES聚合分组后count排序
ES通过多个字段分组后count排序.数据库SQL:select count(1) from table group by storeCode,productId order by count(1) desc;{ "query": { "bool": { "must": [ { "exists": { "field": "storeCod原创 2020-06-09 11:42:40 · 11029 阅读 · 1 评论