Firstly, I understand that there are modules that could be used (https://www.npmjs.com/package/elasticsearch), but I'm looking for a way to solve this with node.js build in modules.
I'm looking for a way to do the following curl request in nodejs using the http module:
source: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-count.html
curl -XGET 'http://localhost:9200/twitter/tweet/_count' -d '
{
"query" : {
"term" : { "user" : "kimchy" }
}
}'
E.g, making a request with a request body.
I have tried as described in the manual for writing post data: https://nodejs.org/api/http.html#http_http_request_options_callback
req.write(parsedData);