Hi,
I want to connect to elasticsearch through elasticsearch node js client. I'm using search api and want to run few aggregation to calculate the total count of docs which passes the given condition. However, im getting this error ...
"error":{"root_cause":[{"type":"parsing_exception","reason":"unknown query [aggs]","line":1,"col":18}],"type":"parsing_exception","reason":"unknown query [aggs]","line":1,"col":18,
"caused_by":{"type":"named_object_not_found_exception","reason":"[1:18] unknown field [aggs]"}},"status":400}
Here the code for api written in node js
client.search({
index: 'data',
body: {
query: {
"aggs": {
"sum_bucket": {
"bucket_path": "questions>_count"
},
"questions": {
"filters": {
"is_question": "yes"
}
}
}
}
}
})
And this is what i want to put in the aggs of search api