+++
title = "Testing Elasticsearch Locally"
weight = 116
updated = 2023-07-07

aliases = ["/docs/testing-elasticsearch-locally", "/docs/managed-search/elasticsearch-and-opensearch/testing-locally/", "/docs/using-your-cluster/testing-locally/"]

[extra]
nav_title = "Testing Locally"
weight = 50
+++

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. Please download
an [Elasticsearch version that is compatible with your plan](/docs/platform/version-support/). Find
your OS system below, and follow the instructions to get Elasticsearch running locally and connect to it.

## macOS

```bash
$ brew install elasticsearch
```

## Windows

Windows users can [download Elasticsearch](https://www.elastic.co/downloads/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](https://www.elastic.co/guide/en/elasticsearch/reference/current/windows.html#msi-installer-windows-service)
in Windows.

## Linux

There are many Linux distributions out there, so the exact method of getting Elasticsearch installed will vary.
Generally, you can [download](https://www.elastic.co/downloads/elasticsearch) 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](https://www.archlinux.org/packages/community/x86_64/elasticsearch/), and can be
easily installed via pacman:

```bash
$ sudo pacman -Syu elasticsearch
```

This package also comes with a systemd service file for starting/stopping Elasticsearch with
`sudo systemctl 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](https://www.elastic.co/downloads/elasticsearch) page. Debian-based Linux distributions can use `dpkg` to
install Elasticsearch (note that this doesn’t handle configuring dependencies like Java):

```bash
# 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'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:

```bash
# 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](https://curl.haxx.se/). 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 127.0.0.1).

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

```bash
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!
