The easiest way to understand what Elasticsearch can do for you is to play with it, so let’s get started!
The only requirement for installing Elasticsearch is a recent version of Java. Preferably, you should install the latest version of the official Java from www.java.com.
You can get the latest version of Elasticsearch from elastic.co/downloads/elasticsearch.
To install Elasticsearch, download and extract the archive file for your platform. For more information, see the Installation topic in the Elasticsearch Reference.
Tip
|
When installing Elasticsearch in production, you can choose to use the Debian or RPM packages provided on the downloads page. You can also use the officially supported Puppet module or Chef cookbook. |
Once you’ve extracted the archive file, Elasticsearch is ready to run. To start it up in the foreground:
cd elasticsearch-<version>
./bin/elasticsearch (1) (2)
-
Add
-d
if you want to run it in the background as a daemon. -
If you’re running Elasticsearch on Windows, simply run
bin\elasticsearch.bat
instead.
Test it out by opening another terminal window and running the following:
curl 'http://localhost:9200/?pretty'
Tip
|
If you’re running Elasticsearch on Windows, you can download cURL from
http://curl.haxx.se/download.html . cURL
provides a convenient way to submit requests to Elasticsearch and
installing cURL enables you to copy and paste many of the examples in this
book to try them out.
|
You should see a response like this:
{
"name" : "Tom Foster",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.1.0",
"build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87",
"build_timestamp" : "2015-11-18T22:40:03Z",
"build_snapshot" : false,
"lucene_version" : "5.3.1"
},
"tagline" : "You Know, for Search"
}
This means that you have an Elasticsearch node up and running, and you can
start experimenting with it. A node is a running instance of Elasticsearch.
A cluster is a group of
nodes with the same cluster.name
that are working together to share data
and to provide failover and scale. (A single node, however, can form a cluster
all by itself.) You can change the cluster.name
in the elasticsearch.yml
configuration
file that’s loaded when you start a node. More information about this and other
Important Configuration Changes is provided
in the Production Deployment section at the end of this book.
Tip
|
See that View in Sense link at the bottom of the example? Install the Sense console to run the examples in this book against your own Elasticsearch cluster and view the results. |
When Elasticsearch is running in the foreground, you can stop it by pressing Ctrl-C.
Sense is a Kibana app that provides an interactive console for submitting requests to Elasticsearch directly from your browser. Many of the code examples in the online version of this book include a View in Sense link. When clicked, it opens up a working example of the code in the Sense console. You do not have to install Sense, but it will make this book much more interactive by allowing you to experiment with the code samples on your local Elasticsearch cluster.
To install and run Sense:
-
Run the following command in the Kibana directory to download and install the Sense app:
./bin/kibana-plugin install elastic/sense (1)
-
Windows:
bin\kibana.bat plugin --install elastic/sense
.NoteYou can download Sense from https://download.elastic.co/elastic/sense/sense-latest.tar.gz to install it on an offline machine.
-
-
Start Kibana.
./bin/kibana (1)
-
Windows:
bin\kibana.bat
.
-
-
Open Sense your web browser by going to
http://localhost:5601/app/sense
.