Skip to content

Commit 9e5cfd0

Browse files
authored
Update README to clarify the use of elastic user password environment variable (#128045)
- Added instructions for exporting the `ES_LOCAL_PASSWORD` environment variable. - Updated the `curl` example and Python client example to use `ES_LOCAL_PASSWORD` for consistency.
1 parent 85f4662 commit 9e5cfd0

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.asciidoc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ From the `elastic-start-local` folder, check the connection to Elasticsearch usi
9797
source .env
9898
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
9999
----
100+
101+
To use the password for the `elastic` user, set and export the `ES_LOCAL_PASSWORD` environment variable. For example:
102+
103+
[source,sh]
104+
----
105+
source .env
106+
export ES_LOCAL_PASSWORD
107+
----
108+
100109
// NOTCONSOLE
101110

102111
=== Send requests to Elasticsearch
@@ -112,22 +121,23 @@ Here's an example curl command to create a new Elasticsearch index, using basic
112121

113122
[source,sh]
114123
----
115-
curl -u elastic:$ELASTIC_PASSWORD \
124+
curl -u elastic:$ES_LOCAL_PASSWORD \
116125
-X PUT \
117126
http://localhost:9200/my-new-index \
118127
-H 'Content-Type: application/json'
119128
----
129+
120130
// NOTCONSOLE
121131

122132
==== Using a language client
123133

124-
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password you set in the environment variable.
134+
To connect to your local dev Elasticsearch cluster with a language client, you can use basic authentication with the `elastic` username and the password stored in the `ES_LOCAL_PASSWORD` environment variable.
125135

126136
You'll use the following connection details:
127137

128138
* **Elasticsearch endpoint**: `http://localhost:9200`
129139
* **Username**: `elastic`
130-
* **Password**: `$ELASTIC_PASSWORD` (Value you set in the environment variable)
140+
* **Password**: `$ES_LOCAL_PASSWORD` (Value you set in the environment variable)
131141

132142
For example, to connect with the Python `elasticsearch` client:
133143

@@ -137,7 +147,7 @@ import os
137147
from elasticsearch import Elasticsearch
138148
139149
username = 'elastic'
140-
password = os.getenv('ELASTIC_PASSWORD') # Value you set in the environment variable
150+
password = os.getenv('ES_LOCAL_PASSWORD') # Value you set in the environment variable
141151
142152
client = Elasticsearch(
143153
"http://localhost:9200",

0 commit comments

Comments
 (0)