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 {ref}/_installation.html[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. |
Marvel is a management and monitoring tool for Elasticsearch, which is free for development use. It comes with an interactive console called Sense, which makes it easy to talk 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 will open up a working example of the code in the Sense console. You do not have to install Marvel, but it will make this book much more interactive by allowing you to experiment with the code samples on your local Elasticsearch cluster.
Marvel is available as a plug-in. To download and install it, run this command in the Elasticsearch directory:
./bin/plugin -i elasticsearch/marvel/latest
Marvel can also be installed using a {marvel-13}installation.html[manual process] if you don’t have internet connectivity.
You probably don’t want Marvel to monitor your local cluster, so you can disable data collection with this command:
echo 'marvel.agent.enabled: false' >> ./config/elasticsearch.yml
Elasticsearch is now 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:
{
"status": 200,
"name": "Shrunken Bones",
"version": {
"number": "1.4.0",
"lucene_version": "4.10"
},
"tagline": "You Know, for Search"
}
This means that your Elasticsearch cluster is up and running, and we can start experimenting with it.
Note
|
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, although a single node can form a cluster
all by itself.
|
You should change the default cluster.name
to something appropriate to you,
like your own name, to stop your nodes from trying to join another cluster on
the same network with the same name!
You can do this by editing the elasticsearch.yml
file in the config/
directory and then restarting Elasticsearch. When Elasticsearch is running in
the foreground, you can stop it by pressing Ctrl-C; otherwise, you can shut
it down with the shutdown
API:
curl -XPOST 'http://localhost:9200/_shutdown'
If you installed the Marvel management and monitoring tool, you can view it in a web browser by visiting http://localhost:9200/_plugin/marvel/.
You can reach the Sense developer console either by clicking the ``Marvel dashboards'' drop-down in Marvel, or by visiting http://localhost:9200/_plugin/marvel/sense/.