elasticsearch-labs icon indicating copy to clipboard operation
elasticsearch-labs copied to clipboard

Changing examples to use hosts instead of Cloud ID

Open JessicaGarson opened this issue 1 year ago • 0 comments

Most of the examples in this repo use Could ID instead of hosts, while chatting with @miguelgrinberg and @joemcelroy we noticed that we should probably update them.

What is in most examples is something like this:

ELASTIC_CLOUD_ID = getpass("Elastic Cloud ID: ")

# https://www.elastic.co/search-labs/tutorials/install-elasticsearch/elastic-cloud#creating-an-api-key
ELASTIC_API_KEY = getpass("Elastic Api Key: ")

A version of this could be:

# Create an Elasticsearch client instance
client = Elasticsearch(
    getpass("Host: "),  # Securely get the host for the Elasticsearch cluster
    api_key=getpass("API Key: "),  # Securely get the API key for authentication
)

JessicaGarson avatar May 01 '24 15:05 JessicaGarson