To take Elasticsearch for a test drive, you can create a hosted deployment on the Elasticsearch Service or set up a multi-node Elasticsearch cluster on your own Linux, macOS, or Windows machine.
Run Elasticsearch on Elastic Cloudedit
When you create a deployment on the Elasticsearch Service, the service provisions a three-node Elasticsearch cluster along with Kibana and APM.
To create a deployment:
- Sign up for a free trial and verify your email address.
- Set a password for your account.
- Click Create Deployment.
Once you’ve created a deployment, you’re ready to Index some documents.
Run Elasticsearch locally on Linux, macOS, or Windowsedit
When you create a deployment on the Elasticsearch Service, a master node and two data nodes are provisioned automatically. By installing from the tar or zip archive, you can start multiple instances of Elasticsearch locally to see how a multi-node cluster behaves.
To run a three-node Elasticsearch cluster locally:
Download the Elasticsearch archive for your OS:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.0-linux-x86_64.tar.gz
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.0.0-darwin-x86_64.tar.gz
Extract the archive:
tar -xvf elasticsearch-8.0.0-linux-x86_64.tar.gz
tar -xvf elasticsearch-8.0.0-darwin-x86_64.tar.gz
Start Elasticsearch from the
Linux and macOS:
cd elasticsearch-8.0.0/bin ./elasticsearch
cd elasticsearch-8.0.0\bin .\elasticsearch.bat
You now have a single-node Elasticsearch cluster up and running!
Start two more instances of Elasticsearch so you can see how a typical multi-node cluster behaves. You need to specify unique data and log paths for each node.
Linux and macOS:
./elasticsearch -Epath.data=data2 -Epath.logs=log2 ./elasticsearch -Epath.data=data3 -Epath.logs=log3
.\elasticsearch.bat -E path.data=data2 -E path.logs=log2 .\elasticsearch.bat -E path.data=data3 -E path.logs=log3
The additional nodes are assigned unique IDs. Because you’re running all three nodes locally, they automatically join the cluster with the first node.
Use the cat health API to verify that your three-node cluster is up running. The cat APIs return information about your cluster and indices in a format that’s easier to read than raw JSON.
You can interact directly with your cluster by submitting HTTP requests to the Elasticsearch REST API. Most of the examples in this guide enable you to copy the appropriate cURL command and submit the request to your local Elasticsearch instance from the command line. If you have Kibana installed and running, you can also open Kibana and submit requests through the Dev Console.
You’ll want to check out the Elasticsearch language clients when you’re ready to start using Elasticsearch in your own applications.
$response = $client->cat()->health(['v' => true]);
var catResponse = client.Cat.Health(h => h.Verbose());
response = es.cat.health(v=True)
The response should indicate that the status of the
greenand it has three nodes:
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 1565052807 00:53:27 elasticsearch green 3 3 6 3 0 0 0 0 - 100.0%
The cluster status will remain yellow if you are only running a single instance of Elasticsearch. A single node cluster is fully functional, but data cannot be replicated to another node to provide resiliency. Replica shards must be available for the cluster status to be green. If the cluster status is red, some data is unavailable.
Other installation optionsedit
Installing Elasticsearch from an archive file enables you to easily install and run multiple instances locally so you can try things out. To run a single instance, you can run Elasticsearch in a Docker container, install Elasticsearch using the DEB or RPM packages on Linux, install using Homebrew on macOS, or install using the MSI package installer on Windows. See Installing Elasticsearch for more information.