Testing Elasticsearch Locally

Do you need to test a certain analyzer or a new Elasticsearch feature? Testing locally is usually the fastest way to make iterative changes before pushing them to staging or production. Find your OS system below, and follow the instructions to get Elasticsearch running locally and connect to it.

$ brew install elasticsearch


Windows users can download Elasticsearch as a ZIP file. Simply extract the contents of the ZIP file, and run bin/elasticsearch.bat to start up an instance. Note that you’ll need Java installed and configured on your system in order for Elasticsearch to run properly.

Elasticsearch can also be run as a service in Windows.


There are many Linux distributions out there, so the exact method of getting Elasticsearch installed will vary. Generally, you can download a tarball of Elasticsearch, and extract the compressed contents to a folder. It should have all of the proper executable permissions set, so you can just run bin/elasticsearch to spin up an instance. Note that if you’re managing Elasticsearch in Linux without a package manager, you’ll need to ensure all the dependencies are met. Java 7+ is a hard requirement, and there may be others.

Arch Linux

Some distributions have preconfigured Elasticsearch binaries available through repositories. Arch Linux, for example, offers it through the community repo, and can be easily installed via pacman:

$ sudo pacman -Syu elasticsearch

This package also comes with a systemd service file for starting/stopping Elasticsearch with sudo systemctl <enable | start | restart| stop> elasticsearch.service.

One caveat with Arch: packages are bleeding edge, which means updates are pushed out as they become available. Bonsai is not a bleeding edge service, so you’ll need to be careful to version lock the Elasticsearch package to whatever version you’re running on Bonsai. You may also need to edit the PKGBUILD and elasticsearch.install files to ensure you’re running the same version locally and on Bonsai.

Ubuntu and Debian-flavors

Other distros can use the DEB and RPM files that Elasticsearch offers on the download page. Debian-based Linux distributions can use dpkg to install Elasticsearch (note that this doesn’t handle configuring dependencies like Java):

# Update the package lists
$ sudo apt-get update

# Make sure Java is installed and working:
$ java -version

# If the version of Java shown is not 7+ (1.7+ if using OpenJDK),
# or it doesn&#39;t recognize java at all, you need to install it:
$ sudo apt-get install openjdk-7-jre

# Download the DEB from Elasticsearch:
$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-X.Y.Z.deb

# Install the DEB:
$ sudo dpkg -i elasticsearch-1.7.2.deb

This approach will install the configuration files to /etc/elasticsearch/ and will add init scripts to /etc/init.d/elasticsearch.

Red Hat / Suse / Fedora / RPM

Elasticsearch does provide an RPM file for installing Elasticsearch on distros using rpm:

# Download the package
$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-X.Y.Z.rpm

# Install it
$ rpm -Uvh elasticsearch-X.Y.Z.rpm

rpm should handle all of the dependency checks as well, so it will tell you if there is something missing.

Testing the Install

Once you have Elasticsearch installed and running on your local machine, you can test to see that it’s up and running with a tool like curl. By default, Elasticsearch will be running on port 9200. Typically the machine will have a name like localhost. If that doesn’t work, you can always use the machine’s local IP address (typically

The curl request and Elasticsearch response should look something like this:

curl localhost:9200/
  "name" : "KLJhbnj",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "HLUKJBjMGJHFIKUIpjPJuREg",
  "version" : {
    "number" : "6.0.1",
    "build_hash" : "e123a8",
    "build_date" : "2019-01-22T00:34:03.743Z",
    "build_snapshot" : false,
    "lucene_version" : "6.5.1"
  "tagline" : "You Know, for Search"

If you see this response, then your local Elasticsearch cluster is up and running! If not, review the documentation for getting Elasticsearch up and running on your operating system and try again.

Once Elasticsearch is running locally, you can configure a local instance of your application to connect to localhost:9200 (this is probably the default for your Elasticsearch client anyway). Now you can test out your application’s Elasticsearch integration locally!