I have elasticsearch 6.7 running on a CentOs 7 machine, and I have node-red running from where I try to query the elastic search.
Using the httprequest node (in node-red) works great when I need to POST data to server, or when I need to perform simple GET _search queries where I can simply send parameters in the url, such as :
http://xxx.xxx.xxx.xxx:9200/data/default/_search?size={{{size}}}&from={{{from}}}&q=sensor:temp
As described in this question.
But if I need more complex queries that have nested parameters I cannot perform it with parameters through the url. For example how would I make this cURL GET with the httprequest node in node-red:
curl -XGET "http://xxx.xxx.xxx.xxx:9200/data/default/_search" -H 'Content-Type: application/json' -d'
{
"size": 0,
"query": {
"range":{
"created":{
"gte":"2019-03-11",
"lte":"2019-03-12"
}
}
},
"aggs": {
"status_terms": {
"terms": {
"field": "device.keyword"
},
"aggs": {
"status_stats": {
"stats": {
"field": "value"
}
}
}
}
}
}'
