Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
ElasticSearch Cookbook - Second Edition
ElasticSearch Cookbook - Second Edition

ElasticSearch Cookbook - Second Edition: Over 130 advanced recipes to search, analyze, deploy, manage, and monitor data effectively with ElasticSearch , Second Edition

eBook
$24.99 $36.99
Paperback
$60.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

ElasticSearch Cookbook - Second Edition

Chapter 2. Downloading and Setting Up

In this chapter, we will cover the following topics:

  • Downloading and installing ElasticSearch
  • Setting up networking
  • Setting up a node
  • Setting up for Linux systems
  • Setting up different node types
  • Installing plugins in ElasticSearch
  • Installing a plugin manually
  • Removing a plugin
  • Changing logging settings

Introduction

This chapter explains how to install and configure ElasticSearch, from a single developer machine to a big cluster, giving you hints on how to improve performance and skip misconfiguration errors.

There are different options to install ElasticSearch and set up a working environment for development and production.

When testing out ElasticSearch for a development cluster, the configuration tool does not require any configurations to be set in it. However, when moving to production, it is important to properly configure the cluster based on your data and use cases. The setup step is very important because a bad configuration can lead to bad results and poor performances, and it can even kill your server.

In this chapter, the management of ElasticSearch plugins is also discussed: installing, configuring, updating, and removing.

Downloading and installing ElasticSearch

ElasticSearch has an active community and the release cycles are very fast.

Because ElasticSearch depends on many common Java libraries (Lucene, Guice, and Jackson are the most famous), the ElasticSearch community tries to keep them updated and fixes bugs that are discovered in them and the ElasticSearch core. The large user base is also a source of new ideas and features to improve ElasticSearch use cases.

For these reasons, if it's possible, best practice is to use the latest available release (usually, the most stable release and with the least bugs).

Getting ready

You need an ElasticSearch supported operating system (Linux / Mac OS X / Windows) with JVM 1.7 or above installed. A web browser is required to download the ElasticSearch binary release.

How to do it…

In order to download and install an ElasticSearch server, we will perform the following steps:

  1. Download ElasticSearch from the web. The latest version is always downloadable at http...

Setting up networking

Correctly setting up networking is very important for your nodes and cluster.

There are a lot of different installation scenarios and networking issues; we will cover two kinds of networking setups in this recipe:

  • A standard installation with an autodiscovery working configuration
  • A forced IP configuration, used if it is not possible to use autodiscovery

Getting ready

You need a working ElasticSearch installation, and you must know your current networking configuration (such as your IP addresses).

How to do it...

In order to configure networking, we will perform the following steps:

  1. With your favorite text editor application, open the ElasticSearch configuration file. Using the standard ElasticSearch configuration file (config/elasticsearch.yml), your node is configured to bind to all your machine interfaces and does an autodiscovery of the broadcasting events, which means that it sends signals to every machine in the current LAN and waits for a response. If a node responds...

Setting up a node

ElasticSearch allows you to customize several parameters in an installation. In this recipe, we'll see the most-used ones in order to define where to store data and improve performance in general.

Getting ready

You need a working ElasticSearch installation.

How to do it...

Perform the following steps to set up a simple node:

  1. Open the config/elasticsearch.yml file with an editor of your choice.
  2. Set up the directories that store your server data:
    • For Linux or Mac OS X:
      path.conf: /opt/data/es/conf
      path.data: /opt/data/es/data1,/opt2/data/data2
      path.work: /opt/data/work
      path.logs: /opt/data/logs
      path.plugins: /opt/data/plugins
    • For Windows:
      path.conf: c:\Elasticsearch\conf
      path.data: c:\Elasticsearch\data
      path.work: c:\Elasticsearch\work
      path.logs: c:\Elasticsearch\logs
      path.plugins: c:\Elasticsearch\plugins
  3. Set up parameters to control the standard index creation. These parameters are:
    index.number_of_shards: 5
    index.number_of_replicas: 1

How it works...

The path.conf parameter defines...

Setting up for Linux systems

If you are using a Linux system, you need to manage extra setup steps to improve performance or to resolve production problems with many indices.

This recipe covers two common errors that occur in production:

  • Too many open files, which can corrupt your indices and data
  • Slow performance when searching and indexing due to the garbage collector

    Note

    Other possible troubles arise when you run out of disk space. In this scenario, some files can get corrupted. To prevent your indices from corruption and possible data loss, a best practice is to monitor the storage space available.

Getting ready

You need a working ElasticSearch installation.

How to do it...

In order to improve performance on Linux systems, perform the following steps:

  1. First, you need to change the current limit of the users that runs the ElasticSearch server. In our examples, we will call it elasticsearch.
  2. To allow ElasticSearch to manage a large number of files, you need to increment the number of file descriptors...

Setting up different node types

ElasticSearch is natively designed for the Cloud, so when you need to release a production environment with a huge number of records, and you need high availability and good performances, you need to aggregate more nodes in a cluster.

ElasticSearch allows you to define different type of node to balance and improve overall performance.

Getting ready

You need a working ElasticSearch installation.

How to do it...

For the advanced setup of a cluster, there are some parameters that must be configured to define different node types.

These parameters are in config/elasticsearch.yml and can be set by performing these steps:

  1. Set up whether or not the node can be a master node:
    node.master: true
  2. Set up whether or not a node must contain data:
    node.data: true

How it works...

The node.master parameter defines whether the node can become a master for the Cloud. The default value for this parameter is true.

A master node is an arbiter for the Cloud: it takes decisions about shard...

Introduction


This chapter explains how to install and configure ElasticSearch, from a single developer machine to a big cluster, giving you hints on how to improve performance and skip misconfiguration errors.

There are different options to install ElasticSearch and set up a working environment for development and production.

When testing out ElasticSearch for a development cluster, the configuration tool does not require any configurations to be set in it. However, when moving to production, it is important to properly configure the cluster based on your data and use cases. The setup step is very important because a bad configuration can lead to bad results and poor performances, and it can even kill your server.

In this chapter, the management of ElasticSearch plugins is also discussed: installing, configuring, updating, and removing.

Downloading and installing ElasticSearch


ElasticSearch has an active community and the release cycles are very fast.

Because ElasticSearch depends on many common Java libraries (Lucene, Guice, and Jackson are the most famous), the ElasticSearch community tries to keep them updated and fixes bugs that are discovered in them and the ElasticSearch core. The large user base is also a source of new ideas and features to improve ElasticSearch use cases.

For these reasons, if it's possible, best practice is to use the latest available release (usually, the most stable release and with the least bugs).

Getting ready

You need an ElasticSearch supported operating system (Linux / Mac OS X / Windows) with JVM 1.7 or above installed. A web browser is required to download the ElasticSearch binary release.

How to do it…

In order to download and install an ElasticSearch server, we will perform the following steps:

  1. Download ElasticSearch from the web. The latest version is always downloadable at http://www.elasticsearch...

Setting up networking


Correctly setting up networking is very important for your nodes and cluster.

There are a lot of different installation scenarios and networking issues; we will cover two kinds of networking setups in this recipe:

  • A standard installation with an autodiscovery working configuration

  • A forced IP configuration, used if it is not possible to use autodiscovery

Getting ready

You need a working ElasticSearch installation, and you must know your current networking configuration (such as your IP addresses).

How to do it...

In order to configure networking, we will perform the following steps:

  1. With your favorite text editor application, open the ElasticSearch configuration file. Using the standard ElasticSearch configuration file (config/elasticsearch.yml), your node is configured to bind to all your machine interfaces and does an autodiscovery of the broadcasting events, which means that it sends signals to every machine in the current LAN and waits for a response. If a node responds...

Setting up a node


ElasticSearch allows you to customize several parameters in an installation. In this recipe, we'll see the most-used ones in order to define where to store data and improve performance in general.

Getting ready

You need a working ElasticSearch installation.

How to do it...

Perform the following steps to set up a simple node:

  1. Open the config/elasticsearch.yml file with an editor of your choice.

  2. Set up the directories that store your server data:

    • For Linux or Mac OS X:

      path.conf: /opt/data/es/conf
      path.data: /opt/data/es/data1,/opt2/data/data2
      path.work: /opt/data/work
      path.logs: /opt/data/logs
      path.plugins: /opt/data/plugins
    • For Windows:

      path.conf: c:\Elasticsearch\conf
      path.data: c:\Elasticsearch\data
      path.work: c:\Elasticsearch\work
      path.logs: c:\Elasticsearch\logs
      path.plugins: c:\Elasticsearch\plugins
  3. Set up parameters to control the standard index creation. These parameters are:

    index.number_of_shards: 5
    index.number_of_replicas: 1

How it works...

The path.conf parameter defines...

Left arrow icon Right arrow icon

Description

If you are a developer who implements ElasticSearch in your web applications and want to sharpen your understanding of the core elements and applications, this is the book for you. It is assumed that you’ve got working knowledge of JSON and, if you want to extend ElasticSearch, of Java and related technologies.

What you will learn

  • Make ElasticSearch work for you by choosing the best cloud topology and powering it with plugins
  • Develop tailored mapping to take full control of index steps
  • Build complex queries through managing indices and documents
  • Optimize search results through executing analytics aggregations
  • Manage rivers (SQL, NoSQL, and webbased) to synchronize and populate crosssource data
  • Develop web interfaces to execute key tasks
  • Monitor the performance of the cluster and nodes

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 28, 2015
Length: 472 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783554843
Vendor :
Elastic
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 28, 2015
Length: 472 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783554843
Vendor :
Elastic
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 176.97
Elasticsearch Server: Second Edition
$54.99
Mastering Elasticsearch - Second Edition
$60.99
ElasticSearch Cookbook - Second Edition
$60.99
Total $ 176.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Getting Started Chevron down icon Chevron up icon
2. Downloading and Setting Up Chevron down icon Chevron up icon
3. Managing Mapping Chevron down icon Chevron up icon
4. Basic Operations Chevron down icon Chevron up icon
5. Search, Queries, and Filters Chevron down icon Chevron up icon
6. Aggregations Chevron down icon Chevron up icon
7. Scripting Chevron down icon Chevron up icon
8. Rivers Chevron down icon Chevron up icon
9. Cluster and Node Monitoring Chevron down icon Chevron up icon
10. Java Integration Chevron down icon Chevron up icon
11. Python Integration Chevron down icon Chevron up icon
12. Plugin Development Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(7 Ratings)
5 star 42.9%
4 star 28.6%
3 star 28.6%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




LSR Nov 19, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Got on time and met my expectations.
Amazon Verified review Amazon
Jan Borgelin Mar 16, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
While cookbooks are not a suitable format for every technology out there, it certainly works for ElasticSearch, as it has so many features to write about.The book covers everything from setting up and configuring a single server or a cluster, working with the REST API (along with good recommendations on plugins to make your life more comfortable) as well as short examples in Python and Java to get you comfortable transforming your knowledge in REST interface to programming languages.Recipes represent common tasks you will encounter while working with ES, thus it serves as a good reference book after you've finished reading it.The 2nd edition of the book is updated for ElasticSearch v.1.4.x, the chapter on aggregations is worth the price tag alone.I highly recommend this book to anyone who needs to quickly master ElasticSearch and is having problems in finding his way through the official documentation.
Amazon Verified review Amazon
A. S. May 05, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Prior to this book, my ElasticSearch knowledge had been cobbled together by updating existing queries, reading a few blog posts, and a healthy amount of documentation skimming. This book seemed promising, especially as a desk-side reference. What I got was so much more.Unlike most of the "cookbooks" I've read, it opens with a well-paced introduction to ElasticSearch, spending a little time focusing on internals (e.g. routing) so that when they're fully discussed in later chapters, readers will already be conversant in some of the concepts. This was the ES tutorial I needed.Then, once it gets into the advanced application portions, it pays off again. ElasticSearch has gained new features over the past few years. Due to their newness, the available documentation (beyond what Elastic provides) is fairly sparse. The ElasticSearch cookbook does a good job of nailing those parts down, especially the chapters on aggregations and scripting.Overall, I'd recommend this book for anyone developing with (or on) ElasticSearch. It's an invaluable resource.
Amazon Verified review Amazon
Wouter Blancquaert Mar 23, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Unlike ‘Mastering ElasticSearch’, which is mostly a complete reference to the product, this book introduces a hands-on introduction to ElasticSearch. This book is not a pageturner, but to understand everything that’s inside, it should be read with a computer nearby. The contents of every chapter is divided in a more or less repeating fashion with following sections: ‘Getting ready’, ‘How to do it’, ‘How it works'; making it easy to read and understand. Accompanied with lots of code samples, you should gain enough insights to use ElasticSearch as a product for as well personal as professional use.
Amazon Verified review Amazon
Michal Domanski Mar 27, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Recommended reading for everyone using or planning to use ElasticSearch. This book combines a hands on approach with a broad spectrum of ElasticSearch features discussed. I'm a heavy user of ElasticSearch and I wish I've read this book earlier.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.