Issue
I am trying to get metrics of our CJE instance. I would like to know whether there is a way to request CJE Elasticsearch data through API endpoints.
Resolution
How to get Elasticsearch data through API
Yes, it is possible. You can get Elasticsearch data as follows
curl -XPOST -u USER:PWD https://<ES_URL>/_search/?search_type=count -d @"query.json" > result.json
where an example query.json
file looks similar to
{ "query": { "filtered": { "query": { "bool": { "must": [{ "range": { "@timestamp": { "gte": 1523000000000, "lte": 1523800000000 } } }] } } } }, "aggs": { "MyGrouping": { "terms": { "field": "controllerName", "size": 0 } } }, "size": 5, "from": 100 }