index/_search POST //index索引
{ "query": { "bool": { "filter": [//过滤条件 { "term": { "business.keyword": { "value": "值", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } }, "aggs": {//聚合查询 "labels": { "nested": { "path": "labels" }, "aggregations": {//查询字段的值总和 "sum": { "sum": { "script": { "source": "doc['labels.sjl.amount'].value + doc['labels.yysb.amount'].value", "lang": "painless" } } } } } } }
下图的sum就是总和
标签:聚合,sum,labels,value,查询,elasticSearch,开发者 From: https://www.cnblogs.com/wj123bk/p/17868393.html