Currently, I am attempting to run a search query using search_type
of count
with the elasticsearch.angular.js version sourced from the npm module.
The query can be successfully executed as follows:
POST /index1/type1/_search?search_type=count
{
"aggs": {
"reviews": {
"nested": {
"path": "reviews"
}
}
}
}
However, when attempting to convert the query to the .js API, an error occurs. The code snippet in question is as follows:
var requestObject = {
index:'index1',
type:'type1',
searchType: 'count',
body: {
query:{
aggs: {
reviews: {
nested: {
path: "reviews"
}
}
}
}
};
esClient.search(requestObject)
The trace output is displayed below:
console.js:1 DEBUG: 2015-08-04T15:28:59Z
starting request { method: 'POST',
path: '/index1/type1/_search',
body: { aggs: { reviews: [Object] } },
query: { search_type: 'count' } }
On the surface, everything seems correct to me as someone new to Elasticsearch, however, upon completion I receive the following error:
ReferenceError: count is not defined
.
Any insights on what may be missing or causing this issue would be greatly appreciated.