This is my code snippet :
if (aggfunction1=="sum")
{
var my_query="{\"size\": 0 ,\"query\": {\"bool\":
{\"must\": {\"match\": { \""+ field1 +"\":\""+ value1 +"\"}}}},
\"aggs\":{\"sum_fld\":{\"sum\": {\"field\":\""+ aggfield1 +"\"}}}}"
console.log(my_query);
client.count({
index: 'paypal',
body:my_query
},
function (err, response)
{
//countM = response.count;
aggs= res.aggregations;
console.log("\nAggregated Value is : " + aggs);
res.send("\nAggregated Value is : " + aggs);
});
};
我在nodejs中运行它,我收到错误?我在弹性搜索中尝试过它,但是它还在给我回复文件吗? 我想要的是什么: 假设我有一个字段SentMails。我想要表中字段等于值的平均SentMails?