2024-10-02 17:12:58 +08:00
////
IMPORTANT: This content is replicated in the Elasticsearch repo root readme. Ensure both files are in sync.
https://github.com/elastic/start-local is the source of truth.
////
2024-05-08 00:10:48 +08:00
[[run-elasticsearch-locally]]
2024-10-02 17:12:58 +08:00
== Run {es} locally
2024-05-08 00:10:48 +08:00
++++
2024-09-25 23:30:01 +08:00
<titleabbrev>Run {es} locally</titleabbrev>
2024-05-08 00:10:48 +08:00
++++
[WARNING]
====
*DO NOT USE THESE INSTRUCTIONS FOR PRODUCTION DEPLOYMENTS*
2024-10-02 17:12:58 +08:00
The instructions on this page are for *local development only*. Do not use this configuration for production deployments, because it is not secure.
Refer to <<elasticsearch-intro-deploy, deployment options>> for a list of production deployment options.
2024-05-08 00:10:48 +08:00
====
2024-10-02 17:12:58 +08:00
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].
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
This setup comes with a one-month trial of the Elastic *Platinum* license.
After the trial period, the license reverts to *Free and open - Basic*.
Refer to https://www.elastic.co/subscriptions[Elastic subscriptions] for more information.
2024-05-08 00:10:48 +08:00
[discrete]
[[local-dev-prerequisites]]
=== Prerequisites
2024-10-02 17:12:58 +08:00
- If you don't have Docker installed, https://www.docker.com/products/docker-desktop[download and install Docker Desktop] for your operating system.
- If you're using Microsoft Windows, then install https://learn.microsoft.com/en-us/windows/wsl/install[Windows Subsystem for Linux (WSL)].
2024-05-08 00:10:48 +08:00
[discrete]
2024-10-02 17:12:58 +08:00
[[local-dev-quick-start]]
=== Run `start-local`
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
To set up {es} and {kib} locally, run the `start-local` script:
2024-05-08 00:10:48 +08:00
[source,sh]
----
2024-10-02 17:12:58 +08:00
curl -fsSL https://elastic.co/start-local | sh
2024-05-08 00:10:48 +08:00
----
// NOTCONSOLE
2024-10-02 17:12:58 +08:00
This script creates an `elastic-start-local` folder containing configuration files and starts both {es} and {kib} using Docker.
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
After running the script, you can access Elastic services at the following endpoints:
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
* *{es}*: http://localhost:9200
* *{kib}*: http://localhost:5601
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
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.
2024-09-11 12:20:08 +08:00
2024-10-02 17:12:58 +08:00
[CAUTION]
2024-05-08 00:10:48 +08:00
====
2024-10-02 17:12:58 +08:00
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`.
2024-05-08 00:10:48 +08:00
====
[discrete]
2024-10-02 17:12:58 +08:00
[[api-access]]
=== API access
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
An API key for {es} is generated and stored in the `.env` file as `ES_LOCAL_API_KEY`.
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>>.
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
From the `elastic-start-local` folder, check the connection to Elasticsearch using `curl`:
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
[source,sh]
----
source .env
curl $ES_LOCAL_URL -H "Authorization: ApiKey ${ES_LOCAL_API_KEY}"
2024-05-08 00:10:48 +08:00
----
// NOTCONSOLE
[discrete]
2024-10-02 17:12:58 +08:00
[[local-dev-additional-info]]
=== Learn more
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
For more detailed information about the `start-local` setup, refer to the https://github.com/elastic/start-local[README on GitHub].
Learn about customizing the setup, logging, and more.
2024-05-08 00:10:48 +08:00
[discrete]
2024-10-02 17:12:58 +08:00
[[local-dev-next-steps]]
=== Next steps
2024-05-08 00:10:48 +08:00
2024-10-02 17:12:58 +08:00
Use our <<quickstart,quick start guides>> to learn the basics of {es}.