Dear all,
I have just recently started working with ElasticSearch and Rest APIs and would like to ask for your help concerning the following issue:
I am using a trial version of ElasticSearch Cloud Service, set up a deployment (Version 7.10.2 ) hosted on AWS and imported the "kibana_sample_data_flights" data set.
The overall goal of my use case is to retrieve cloud-stored data using Rest APIs. As a first step in my "learning journey", I copied the Elasticsearch endpoint from the webpage and was able to perform a basic health check with:
curl -X GET "https://<copyPastedEndpoint>:9243/_health"
returning
{"ok": true, "status": 200}
Next, I wanted to get a list of all indices, so I generated an API key according to the Getting Started Manual on REST APIs and built following request:
curl -v -H "Authorization: ApiKey <copyPastedApiKey>" -X GET "https://<copyPastedEndpoint>:9243/_cat/indices"
Unfortunately, since then I got stuck with this error message:
{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/_cat/indices]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/_cat/indices]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}},"status":401}
Since searching the forum and the web did not really help, I would be very happy if anybody could give me a hint what I have done wrong...
Can I make REST requests using the trial version at all?
Is it correct to simply paste the complete API-key-string in the request after the keyword "ApiKey"? I understand that $EC_API_KEY
(as mentioned in the manual) is just a variable containing the key, right?
By the way: Shouldn't it be $ES_API_KEY ?
Many thanks in advance!