ElasticSearch Cookbook

ElasticSearch Cookbook
eBook: $32.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $87.98    Print cover: $54.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Write native plugins to extend the capabilities of ElasticSearch to boost your business
  • Integrate the power of ElasticSearch in your Java applications using the native API or Python applications, with the ElasticSearch community client
  • Step-by step-instructions to help you easily understand ElasticSearch’s capabilities, that act as a good reference for everyday activities

Book Details

Language : English
Paperback : 422 pages [ 235mm x 191mm ]
Release Date : December 2013
ISBN : 1782166629
ISBN 13 : 9781782166627
Author(s) : Alberto Paro
Topics and Technologies : All Books, Big Data and Business Intelligence, Cookbooks, Open Source

Table of Contents

Chapter 1: Getting Started
Chapter 2: Downloading and Setting Up ElasticSearch
Chapter 3: Managing Mapping
Chapter 4: Standard Operations
Chapter 5: Search, Queries, and Filters
Chapter 6: Facets
Chapter 7: Scripting
Chapter 8: Rivers
Chapter 9: Cluster and Nodes Monitoring
Chapter 10: Java Integration
Chapter 11: Python Integration
Chapter 12: Plugin Development
  • Chapter 1: Getting Started
    • Introduction
    • Understanding node and cluster
    • Understanding node services
    • Managing your data
    • Understanding cluster, replication, and sharding
    • Communicating with ElasticSearch
    • Using the HTTP protocol
    • Using the Native protocol
    • Using the Thrift protocol
  • Chapter 2: Downloading and Setting Up ElasticSearch
    • Introduction
    • Downloading and installing ElasticSearch
    • Networking setup
    • Setting up a node
    • Setting up ElasticSearch for Linux systems (advanced)
    • Setting up different node types (advanced)
    • Installing a plugin
    • Installing a plugin manually
    • Removing a plugin
    • Changing logging settings (advanced)
  • Chapter 3: Managing Mapping
    • Introduction
    • Using explicit mapping creation
    • Mapping base types
    • Mapping arrays
    • Mapping an object
    • Mapping a document
    • Using dynamic templates in document mapping
    • Managing nested objects
    • Managing a child document
    • Mapping a multifield
    • Mapping a GeoPoint field
    • Mapping a GeoShape field
    • Mapping an IP field
    • Mapping an attachment field
    • Adding generic data to mapping
    • Mapping different analyzers
  • Chapter 4: Standard Operations
    • Introduction
    • Creating an index
    • Deleting an index
    • Opening/closing an index
    • Putting a mapping in an index
    • Getting a mapping
    • Deleting a mapping
    • Refreshing an index
    • Flushing an index
    • Optimizing an index
    • Checking if an index or type exists
    • Managing index settings
    • Using index aliases
    • Indexing a document
    • Getting a document
    • Deleting a document
    • Updating a document
    • Speeding up atomic operations (bulk)
    • Speeding up GET
  • Chapter 5: Search, Queries, and Filters
    • Introduction
    • Executing a search
    • Sorting a search
    • Highlighting results
    • Executing a scan query
    • Suggesting a correct query
    • Counting
    • Deleting by query
    • Matching all the documents
    • Querying/filtering for term
    • Querying/filtering for terms
    • Using a prefix query/filter
    • Using a Boolean query/filter
    • Using a range query/filter
    • Using span queries
    • Using the match query
    • Using the IDS query/filter
    • Using the has_child query/filter
    • Using the top_children query
    • Using the has_parent query/filter
    • Using a regexp query/filter
    • Using exists and missing filters
    • Using and/or/not filters
    • Using the geo_bounding_box filter
    • Using the geo_polygon filter
    • Using the geo_distance filter
  • Chapter 6: Facets
    • Introduction
    • Executing facets
    • Executing terms facets
    • Executing range facets
    • Executing histogram facets
    • Executing date histogram facets
    • Executing filter/query facets
    • Executing statistical facets
    • Executing term statistical facets
    • Executing geo distance facets
  • Chapter 7: Scripting
    • Introduction
    • Installing additional script plugins
    • Sorting using script
    • Computing return fields with scripting
    • Filtering a search via scripting
    • Updating with scripting
  • Chapter 8: Rivers
    • Introduction
    • Managing a river
    • Using the CouchDB river
    • Using the MongoDB river
    • Using the RabbitMQ river
    • Using the JDBC river
    • Using the Twitter river
  • Chapter 9: Cluster and Nodes Monitoring
    • Introduction
    • Controlling cluster health via API
    • Controlling cluster state via API
    • Getting nodes information via API
    • Getting node statistic via API
    • Installing and using BigDesk
    • Installing and using ElasticSearc-head
    • Installing and using SemaText SPM
  • Chapter 10: Java Integration
    • Introduction
    • Creating an HTTP client
    • Creating a native client
    • Managing indices with the native client
    • Managing mappings
    • Managing documents
    • Managing bulk action
    • Creating a query
    • Executing a standard search
    • Executing a facet search
    • Executing a scroll/scan search
  • Chapter 11: Python Integration
    • Introduction
    • Creating a client
    • Managing indices
    • Managing mappings
    • Managing documents
    • Executing a standard search
    • Executing a facet search
  • Chapter 12: Plugin Development
    • Introduction
    • Creating a site plugin
    • Creating a simple plugin
    • Creating a REST plugin
    • Creating a cluster action
    • Creating an analyzer plugin
    • Creating a river plugin

Alberto Paro

Alberto Paro is an engineer, a project manager, and a software developer. He currently works as a CTO at The Net Planet Europe and as a Freelance Consultant of software engineering on Big Data and NoSQL solutions. He loves studying emerging solutions and applications mainly related to Big Data processing, NoSQL, Natural Language Processing, and neural networks. He started programming in Basic on a Sinclair Spectrum when he was eight years old and in his life he has gained a lot of experience using different operative systems, applications, and programming.

In 2000, he completed Computer Science engineering from Politecnico di Milano with a thesis on designing multi-users and multidevices web applications. He worked as a professor helper at the university for about one year. Then, after coming in contact with The Net Planet company and loving their innovation ideas, he started working on knowledge management solutions and advanced data-mining products.

In his spare time, when he is not playing with his children, he likes working on open source projects. When he was in high school, he started contributing to projects related to the Gnome environment (GTKMM). One of his preferred programming languages was Python and he wrote one of the first NoSQL backend for Django for MongoDB (django-mongodb-engine). In 2010, he started using ElasticSearch to provide search capabilities for some Django e-commerce sites and developed PyES (a pythonic client for ElasticSearch) and the initial part of ElasticSearch MongoDB River.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 1 submitted: last submission 08 May 2014

Errata type: Code Pg No: 152

It is: "include_in_lower" and "include_in_upper"

It should be: include_lower and "include_upper"


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

ElasticSearch Cookbook +    Salesforce CRM: The Definitive Admin Handbook =
50% Off
the second eBook
Price for both: $47.10

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Choose the best ElasticSearch cloud topology to deploy and power it up with external plugins
  • Control the index steps with tailored mappings
  • Manage indices and documents and build a complex query against them
  • Execute facets to compute analytics against your data to improve searches and results
  • Use scripting to bypass limits of search, facets, and updates
  • Synchronize and populate data from different data sources, by managing rivers (SQL, NoSQL, web)
  • Monitor the cluster and node performances, and execute common tasks via web interfaces
  • Integrate ElasticSearch in Python and Java applications
  • Extend the capabilities of ElasticSearch by writing your own plugin to add REST calls, rivers, and custom cluster actions

In Detail

ElasticSearch is one of the most promising NoSQL technologies available and is built to provide a scalable search solution with built-in support for near real-time search and multi-tenancy.

This practical guide is a complete reference for using ElasticSearch and covers 360 degrees of the ElasticSearch ecosystem. We will get started by showing you how to choose the correct transport layer, communicate with the server, and create custom internal actions for boosting tailored needs.

Starting with the basics of the ElasticSearch architecture and how to efficiently index, search, and execute analytics on it, you will learn how to extend ElasticSearch by scripting and monitoring its behaviour.

Step-by-step, this book will help you to improve your ability to manage data in indexing with more tailored mappings, along with searching and executing analytics with facets. The topics explored in the book also cover how to integrate ElasticSearch with Python and Java applications.

This comprehensive guide will allow you to master storing, searching, and analyzing data with ElasticSearch.


Written in an engaging, easy-to-follow style, the recipes will help you to extend the capabilities of ElasticSearch to manage your data effectively.

Who this book is for

If you are a developer who implements ElasticSearch in your web applications, manage data, or have decided to start using ElasticSearch, this book is ideal for you. This book assumes that you’ve got working knowledge of JSON and Java.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software