WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Installing and Running Elasticsearchedit
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.
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:
Add |
|
If you’re running Elasticsearch on Windows, simply run |
Test it out by opening another terminal window and running the following:
curl 'http://localhost:9200/?pretty'
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.
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.
Installing Senseedit
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:
You can download Sense from https://download.elastic.co/elastic/sense/sense-latest.tar.gz to install it on an offline machine.
-
Start Kibana.
-
Open Sense your web browser by going to
http://localhost:5601/app/sense
.
- Elasticsearch - The Definitive Guide:
- Foreword
- Preface
- Getting Started
- You Know, for Search…
- Installing and Running Elasticsearch
- Talking to Elasticsearch
- Document Oriented
- Finding Your Feet
- Indexing Employee Documents
- Retrieving a Document
- Search Lite
- Search with Query DSL
- More-Complicated Searches
- Full-Text Search
- Phrase Search
- Highlighting Our Searches
- Analytics
- Tutorial Conclusion
- Distributed Nature
- Next Steps
- Life Inside a Cluster
- Data In, Data Out
- What Is a Document?
- Document Metadata
- Indexing a Document
- Retrieving a Document
- Checking Whether a Document Exists
- Updating a Whole Document
- Creating a New Document
- Deleting a Document
- Dealing with Conflicts
- Optimistic Concurrency Control
- Partial Updates to Documents
- Retrieving Multiple Documents
- Cheaper in Bulk
- Distributed Document Store
- Searching—The Basic Tools
- Mapping and Analysis
- Full-Body Search
- Sorting and Relevance
- Distributed Search Execution
- Index Management
- Inside a Shard
- You Know, for Search…
- Search in Depth
- Structured Search
- Full-Text Search
- Multifield Search
- Proximity Matching
- Partial Matching
- Controlling Relevance
- Theory Behind Relevance Scoring
- Lucene’s Practical Scoring Function
- Query-Time Boosting
- Manipulating Relevance with Query Structure
- Not Quite Not
- Ignoring TF/IDF
- function_score Query
- Boosting by Popularity
- Boosting Filtered Subsets
- Random Scoring
- The Closer, The Better
- Understanding the price Clause
- Scoring with Scripts
- Pluggable Similarity Algorithms
- Changing Similarities
- Relevance Tuning Is the Last 10%
- Dealing with Human Language
- Aggregations
- Geolocation
- Modeling Your Data
- Administration, Monitoring, and Deployment