Get Elasticsearch up and running

edit

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 Cloud

edit

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:

  1. Sign up for a free trial and verify your email address.
  2. Set a password for your account.
  3. Click Create Deployment.

Once you’ve created a deployment, you’re ready to Index some documents.

Run Elasticsearch locally on Linux, macOS, or Windows

edit

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:

  1. Download the Elasticsearch archive for your OS:

    Linux: elasticsearch-7.0.1-linux-x86_64.tar.gz

    curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-linux-x86_64.tar.gz

    macOS: elasticsearch-7.0.1-darwin-x86_64.tar.gz

    curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.1-darwin-x86_64.tar.gz

    Windows: elasticsearch-7.0.1-windows-x86_64.zip

  2. Extract the archive:

    Linux:

    tar -xvf elasticsearch-7.0.1-linux-x86_64.tar.gz

    macOS:

    tar -xvf elasticsearch-7.0.1-darwin-x86_64.tar.gz

    Windows PowerShell:

    Expand-Archive elasticsearch-7.0.1-windows-x86_64.zip
  3. Start Elasticsearch from the bin directory:

    Linux and macOS:

    cd elasticsearch-7.0.1/bin
    ./elasticsearch

    Windows:

    cd %PROGRAMFILES%\Elastic\Elasticsearch\bin
    .\elasticsearch.exe

    You now have a single-node Elasticsearch cluster up and running!

  4. 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

    Windows:

    .\elasticsearch.exe -Epath.data=data2 -Epath.logs=log2
    .\elasticsearch.exe -Epath.data=data3 -Epath.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.

  5. 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.

    GET /_cat/health?v

    The response should indicate that the status of the elasticsearch cluster is green and 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 options

edit

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.