弹性搜索中的聚合查询不返回输出

时间:2017-12-01 12:03:06

标签: node.js elasticsearch

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?

0 个答案:

没有答案