Accessing search API using api key and acces token-based authentication

Hi, I need some help accessing the Search API. I Have elastic cloud setup as azure managed service. I can access the cloud Service API using API key-based authentication:

curl -X GET -H "Authorization: ApiKey <api_key>"

but its not clear how to access data through the Search API

  1. What baseurl do I use? Is it the console host endpoint? e.g., , i.e.,
curl -X GET "<port>/<index>/_search" -H 'Content-Type: application/json' -d '{...}'
  1. Can I use the same api key or do I have to generate a new key using the Create API key API? and how do I authenticate the create api key request?
  2. For OAuth2 flow, how do I create a user/password (or client key/secret) that I can then exchange for an access token, ie
curl -X POST "<base_url>/_security/oauth2/token" -H 'Content-Type: application/json' -d' 
  "grant_type" : "password", 
  "username" : "<username>", 
  "password" : "<password>" 

curl -X POST "<base_url>/_security/oauth2/token" -H 'Content-Type: application/json' -d' 
  "grant_type" : "client_credentials", 
  "username" : "<key>", 
  "password" : "<secret>" 


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.