Skip to content

Commit 51570a0

Browse files
authored
[DOCS] Update local dev instructions to use start-local (#113848)
https://www.elastic.co/start-local is live and will be our go-to local dev setup. This PR: - Updates both the Elasticsearch root readme and `run-elasticsearch-locally.asciidoc` 🧹 Also try to keep as concise as possible by not mirroring _everything_ in readme
1 parent 7f2f0b8 commit 51570a0

File tree

2 files changed

+82
-186
lines changed

2 files changed

+82
-186
lines changed

README.asciidoc

Lines changed: 40 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ https://www.elastic.co/downloads/elasticsearch[elastic.co/downloads/elasticsearc
3333
=== Run Elasticsearch locally
3434

3535
////
36-
IMPORTANT: This content is replicated in the Elasticsearch guide. See `run-elasticsearch-locally.asciidoc`.
37-
Both will soon be replaced by a quickstart script.
38-
////
36+
IMPORTANT: This content is replicated in the Elasticsearch repo. See `run-elasticsearch-locally.asciidoc`.
37+
Ensure both files are in sync.
38+
39+
https://github.com/elastic/start-local is the source of truth.
40+
////
3941

4042
[WARNING]
4143
====
@@ -44,89 +46,67 @@ DO NOT USE THESE INSTRUCTIONS FOR PRODUCTION DEPLOYMENTS.
4446
This setup is intended for local development and testing only.
4547
====
4648

47-
The following commands help you very quickly spin up a single-node Elasticsearch cluster, together with Kibana in Docker.
48-
Use this setup for local development or testing.
49+
Quickly set up Elasticsearch and Kibana in Docker for local development or testing, using the https://github.com/elastic/start-local?tab=readme-ov-file#-try-elasticsearch-and-kibana-locally[`start-local` script].
4950

50-
==== Prerequisites
51+
ℹ️ For more detailed information about the `start-local` setup, refer to the https://github.com/elastic/start-local[README on GitHub].
5152

52-
If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
53+
==== Prerequisites
5354

54-
==== Set environment variables
55+
- If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
56+
- If you're using Microsoft Windows, then install https://learn.microsoft.com/en-us/windows/wsl/install[Windows Subsystem for Linux (WSL)].
5557

56-
Configure the following environment variables.
58+
==== Trial license
5759

58-
[source,sh]
59-
----
60-
export ELASTIC_PASSWORD="<ES_PASSWORD>" # password for "elastic" username
61-
export KIBANA_PASSWORD="<KIB_PASSWORD>" # Used internally by Kibana, must be at least 6 characters long
62-
----
60+
This setup comes with a one-month trial of the Elastic *Platinum* license.
61+
After the trial period, the license reverts to *Free and open - Basic*.
62+
Refer to https://www.elastic.co/subscriptions[Elastic subscriptions] for more information.
6363

64-
==== Create a Docker network
64+
==== Run `start-local`
6565

66-
To run both Elasticsearch and Kibana, you'll need to create a Docker network:
66+
To set up Elasticsearch and Kibana locally, run the `start-local` script:
6767

6868
[source,sh]
6969
----
70-
docker network create elastic-net
70+
curl -fsSL https://elastic.co/start-local | sh
7171
----
72+
// NOTCONSOLE
7273

73-
==== Run Elasticsearch
74+
This script creates an `elastic-start-local` folder containing configuration files and starts both Elasticsearch and Kibana using Docker.
7475

75-
Start the Elasticsearch container with the following command:
76+
After running the script, you can access Elastic services at the following endpoints:
7677

77-
[source,sh]
78-
----
79-
docker run -p 127.0.0.1:9200:9200 -d --name elasticsearch --network elastic-net \
80-
-e ELASTIC_PASSWORD=$ELASTIC_PASSWORD \
81-
-e "discovery.type=single-node" \
82-
-e "xpack.security.http.ssl.enabled=false" \
83-
-e "xpack.license.self_generated.type=trial" \
84-
docker.elastic.co/elasticsearch/elasticsearch:{version}
85-
----
78+
* *Elasticsearch*: http://localhost:9200
79+
* *Kibana*: http://localhost:5601
8680

87-
==== Run Kibana (optional)
81+
The script generates a random password for the `elastic` user, which is displayed at the end of the installation and stored in the `.env` file.
8882

89-
To run Kibana, you must first set the `kibana_system` password in the Elasticsearch container.
83+
[CAUTION]
84+
====
85+
This setup is for local testing only. HTTPS is disabled, and Basic authentication is used for Elasticsearch. For security, Elasticsearch and Kibana are accessible only through `localhost`.
86+
====
9087

91-
[source,sh]
92-
----
93-
# configure the Kibana password in the ES container
94-
curl -u elastic:$ELASTIC_PASSWORD \
95-
-X POST \
96-
http://localhost:9200/_security/user/kibana_system/_password \
97-
-d '{"password":"'"$KIBANA_PASSWORD"'"}' \
98-
-H 'Content-Type: application/json'
99-
----
100-
// NOTCONSOLE
88+
==== API access
10189

102-
Start the Kibana container with the following command:
90+
An API key for Elasticsearch is generated and stored in the `.env` file as `ES_LOCAL_API_KEY`.
91+
Use this key to connect to Elasticsearch with a https://www.elastic.co/guide/en/elasticsearch/client/index.html[programming language client] or the https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html[REST API].
92+
93+
From the `elastic-start-local` folder, check the connection to Elasticsearch using `curl`:
10394

10495
[source,sh]
96+
----
97+
source .env
98+
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
10599
----
106-
docker run -p 127.0.0.1:5601:5601 -d --name kibana --network elastic-net \
107-
-e ELASTICSEARCH_URL=http://elasticsearch:9200 \
108-
-e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 \
109-
-e ELASTICSEARCH_USERNAME=kibana_system \
110-
-e ELASTICSEARCH_PASSWORD=$KIBANA_PASSWORD \
111-
-e "xpack.security.enabled=false" \
112-
-e "xpack.license.self_generated.type=trial" \
113-
docker.elastic.co/kibana/kibana:{version}
114-
----
115-
116-
.Trial license
117-
[%collapsible]
118-
====
119-
The service is started with a trial license. The trial license enables all features of Elasticsearch for a trial period of 30 days. After the trial period expires, the license is downgraded to a basic license, which is free forever. If you prefer to skip the trial and use the basic license, set the value of the `xpack.license.self_generated.type` variable to basic instead. For a detailed feature comparison between the different licenses, refer to our https://www.elastic.co/subscriptions[subscriptions page].
120-
====
100+
// NOTCONSOLE
121101

122-
==== Send requests to Elasticsearch
102+
=== Send requests to Elasticsearch
123103

124104
You send data and other requests to Elasticsearch through REST APIs.
125105
You can interact with Elasticsearch using any client that sends HTTP requests,
126106
such as the https://www.elastic.co/guide/en/elasticsearch/client/index.html[Elasticsearch
127107
language clients] and https://curl.se[curl].
128108

129-
===== Using curl
109+
==== Using curl
130110

131111
Here's an example curl command to create a new Elasticsearch index, using basic auth:
132112

@@ -139,7 +119,7 @@ curl -u elastic:$ELASTIC_PASSWORD \
139119
----
140120
// NOTCONSOLE
141121

142-
===== Using a language client
122+
==== Using a language client
143123

144124
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.
145125

@@ -167,7 +147,7 @@ client = Elasticsearch(
167147
print(client.info())
168148
----
169149

170-
===== Using the Dev Tools Console
150+
==== Using the Dev Tools Console
171151

172152
Kibana's developer console provides an easy way to experiment and test requests.
173153
To access the console, open Kibana, then go to **Management** > **Dev Tools**.
Lines changed: 42 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
////
2+
IMPORTANT: This content is replicated in the Elasticsearch repo root readme. Ensure both files are in sync.
3+
4+
https://github.com/elastic/start-local is the source of truth.
5+
////
6+
17
[[run-elasticsearch-locally]]
2-
== Run {es} locally in Docker
8+
== Run {es} locally
39
++++
410
<titleabbrev>Run {es} locally</titleabbrev>
511
++++
@@ -8,164 +14,74 @@
814
====
915
*DO NOT USE THESE INSTRUCTIONS FOR PRODUCTION DEPLOYMENTS*
1016
11-
The instructions on this page are for *local development only*. Do not use these instructions for production deployments, because they are not secure.
12-
While this approach is convenient for experimenting and learning, you should never run Elasticsearch in this way in a production environment.
17+
The instructions on this page are for *local development only*. Do not use this configuration for production deployments, because it is not secure.
18+
Refer to <<elasticsearch-intro-deploy, deployment options>> for a list of production deployment options.
1319
====
1420

15-
Follow this tutorial if you want to quickly set up {es} in Docker for local development or testing.
21+
Quickly set up {es} and {kib} in Docker for local development or testing, using the https://github.com/elastic/start-local?tab=readme-ov-file#-try-elasticsearch-and-kibana-locally[`start-local` script].
1622

17-
This tutorial also includes instructions for installing {kib}.
18-
If you don't need access to the {kib} UI, then you can skip those instructions.
23+
This setup comes with a one-month trial of the Elastic *Platinum* license.
24+
After the trial period, the license reverts to *Free and open - Basic*.
25+
Refer to https://www.elastic.co/subscriptions[Elastic subscriptions] for more information.
1926

2027
[discrete]
2128
[[local-dev-prerequisites]]
2229
=== Prerequisites
2330

24-
If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
31+
- If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
32+
- If you're using Microsoft Windows, then install https://learn.microsoft.com/en-us/windows/wsl/install[Windows Subsystem for Linux (WSL)].
2533

2634
[discrete]
27-
[[local-dev-env-vars]]
28-
=== Set environment variables
35+
[[local-dev-quick-start]]
36+
=== Run `start-local`
2937

30-
Configure the following environment variables.
38+
To set up {es} and {kib} locally, run the `start-local` script:
3139

3240
[source,sh]
3341
----
34-
export ELASTIC_PASSWORD="<ES_PASSWORD>" # password for "elastic" username
35-
export KIBANA_PASSWORD="<KIB_PASSWORD>" # Used _internally_ by Kibana, must be at least 6 characters long
36-
----
37-
38-
[discrete]
39-
[[local-dev-create-docker-network]]
40-
=== Create a Docker network
41-
42-
To run both {es} and {kib}, you'll need to create a Docker network:
43-
44-
[source,sh]
45-
----
46-
docker network create elastic-net
47-
----
48-
49-
[discrete]
50-
[[local-dev-run-es]]
51-
=== Run {es}
52-
53-
Start the {es} container with the following command:
54-
55-
ifeval::["{release-state}"=="unreleased"]
56-
WARNING: Version {version} has not yet been released.
57-
No Docker image is currently available for {es} {version}.
58-
endif::[]
59-
60-
[source,sh,subs="attributes"]
61-
----
62-
docker run -p 127.0.0.1:9200:9200 -d --name elasticsearch --network elastic-net \
63-
-e ELASTIC_PASSWORD=$ELASTIC_PASSWORD \
64-
-e "discovery.type=single-node" \
65-
-e "xpack.security.http.ssl.enabled=false" \
66-
-e "xpack.license.self_generated.type=trial" \
67-
{docker-image}
68-
----
69-
70-
[discrete]
71-
[[local-dev-run-kib]]
72-
=== Run {kib} (optional)
73-
74-
To run {kib}, you must first set the `kibana_system` password in the {es} container.
75-
76-
[source,sh,subs="attributes"]
77-
----
78-
# configure the Kibana password in the ES container
79-
curl -u elastic:$ELASTIC_PASSWORD \
80-
-X POST \
81-
http://localhost:9200/_security/user/kibana_system/_password \
82-
-d '{"password":"'"$KIBANA_PASSWORD"'"}' \
83-
-H 'Content-Type: application/json'
42+
curl -fsSL https://elastic.co/start-local | sh
8443
----
8544
// NOTCONSOLE
8645

87-
Start the {kib} container with the following command:
46+
This script creates an `elastic-start-local` folder containing configuration files and starts both {es} and {kib} using Docker.
8847

89-
ifeval::["{release-state}"=="unreleased"]
90-
WARNING: Version {version} has not yet been released.
91-
No Docker image is currently available for {es} {version}.
92-
endif::[]
48+
After running the script, you can access Elastic services at the following endpoints:
9349

94-
[source,sh,subs="attributes"]
95-
----
96-
docker run -p 127.0.0.1:5601:5601 -d --name kibana --network elastic-net \
97-
-e ELASTICSEARCH_URL=http://elasticsearch:9200 \
98-
-e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 \
99-
-e ELASTICSEARCH_USERNAME=kibana_system \
100-
-e ELASTICSEARCH_PASSWORD=$KIBANA_PASSWORD \
101-
-e "xpack.security.enabled=false" \
102-
-e "xpack.license.self_generated.type=trial" \
103-
{kib-docker-image}
104-
----
50+
* *{es}*: http://localhost:9200
51+
* *{kib}*: http://localhost:5601
10552

106-
When you access {kib}, use `elastic` as the username and the password you set earlier for the `ELASTIC_PASSWORD` environment variable.
53+
The script generates a random password for the `elastic` user, which is displayed at the end of the installation and stored in the `.env` file.
10754

108-
[NOTE]
55+
[CAUTION]
10956
====
110-
The service is started with a trial license. The trial license enables all features of Elasticsearch for a trial period of 30 days. After the trial period expires, the license is downgraded to a basic license, which is free forever.
57+
This setup is for local testing only. HTTPS is disabled, and Basic authentication is used for {es}. For security, {es} and {kib} are accessible only through `localhost`.
11158
====
11259

11360
[discrete]
114-
[[local-dev-connecting-clients]]
115-
=== Connect to {es} with language clients
116-
117-
To connect to the {es} cluster from a language client, you can use basic authentication with the `elastic` username and the password you set in the environment variable.
118-
119-
.*Expand* for details
120-
[%collapsible]
121-
==============
122-
123-
You'll use the following connection details:
124-
125-
* **{es} endpoint**: `http://localhost:9200`
126-
* **Username**: `elastic`
127-
* **Password**: `$ELASTIC_PASSWORD` (Value you set in the environment variable)
128-
129-
For example, to connect with the Python `elasticsearch` client:
130-
131-
[source,python]
132-
----
133-
import os
134-
from elasticsearch import Elasticsearch
61+
[[api-access]]
62+
=== API access
13563

136-
username = 'elastic'
137-
password = os.getenv('ELASTIC_PASSWORD') # Value you set in the environment variable
64+
An API key for {es} is generated and stored in the `.env` file as `ES_LOCAL_API_KEY`.
65+
Use this key to connect to {es} with a https://www.elastic.co/guide/en/elasticsearch/client/index.html[programming language client] or the <<rest-apis,REST API>>.
13866

139-
client = Elasticsearch(
140-
"http://localhost:9200",
141-
basic_auth=(username, password)
142-
)
67+
From the `elastic-start-local` folder, check the connection to Elasticsearch using `curl`:
14368

144-
print(client.info())
145-
----
146-
147-
Here's an example curl command using basic authentication:
148-
149-
[source,sh,subs="attributes"]
150-
----
151-
curl -u elastic:$ELASTIC_PASSWORD \
152-
-X PUT \
153-
http://localhost:9200/my-new-index \
154-
-H 'Content-Type: application/json'
69+
[source,sh]
70+
----
71+
source .env
72+
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
15573
----
15674
// NOTCONSOLE
15775

158-
==============
159-
16076
[discrete]
161-
[[local-dev-next-steps]]
162-
=== Next steps
77+
[[local-dev-additional-info]]
78+
=== Learn more
16379

164-
Use our <<quickstart,quick start guides>> to learn the basics of {es}.
80+
For more detailed information about the `start-local` setup, refer to the https://github.com/elastic/start-local[README on GitHub].
81+
Learn about customizing the setup, logging, and more.
16582

16683
[discrete]
167-
[[local-dev-production]]
168-
=== Moving to production
84+
[[local-dev-next-steps]]
85+
=== Next steps
16986

170-
This setup is not suitable for production use.
171-
Refer to <<elasticsearch-intro-deploy, deployment options>> for more information.
87+
Use our <<quickstart,quick start guides>> to learn the basics of {es}.

0 commit comments

Comments
 (0)