Elastic Cloud
editElastic Cloud
editSearch::Elasticsearch can be used to connect to Elastic Cloud.
To connect the Perl client to Elastic Cloud you need the get the following data:
- the Elasticsearch server address (i.e. public URL);
- the Elastic Cloud API key;
You can retrieve these data from your Elastic Cloud dashboard. You need to open the Manage Deployments page and Copy endpoint of Elasticsearch (see screenshot below).
This endpoint is the server address of Test instance (e.g. https://my-test.es.us-central1.gcp.cloud.es.io).
After this step, you need to generate an API key in the Management page under the section Security.
When you click on Create API key button you can choose a name and set the other options (for example, restrict privileges, expire after time, and so on).
After this step you will get the API key in the API keys page.
IMPORTANT: you need to copy and store the `API key`in a secure place, since you will not be able to view it again in Elastic Cloud.
Finally, you can use the Elasticsearch endpoint and the API Key for connecting the Perl client as follows:
my $e = Search::Elasticsearch->new( nodes => [ 'https://my-test.es.us-central1.gcp.cloud.es.io' ], elastic_cloud_api_key => 'insert here the API Key' );