PacktLib: ElasticSearch Cookbook

ElasticSearch Cookbook


About the Author

About the Reviewers


Getting Started


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

Downloading and Setting Up ElasticSearch


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)

Managing Mapping


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

Standard Operations


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

Search, Queries, and Filters


Executing a search

Sorting a search

Highlighting results

Executing a scan query

Suggesting a correct query


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



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



Installing additional script plugins

Sorting using script

Computing return fields with scripting

Filtering a search via scripting

Updating with scripting



Managing a river

Using the CouchDB river

Using the MongoDB river

Using the RabbitMQ river

Using the JDBC river

Using the Twitter river

Cluster and Nodes Monitoring


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 ElasticSerach-head

Installing and using SemaText SPM

Java Integration


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

Python Integration


Creating a client

Managing indices

Managing mappings

Managing documents

Executing a standard search

Executing a facet search

Plugin Development


Creating a site plugin

Creating a simple plugin

Creating a REST plugin

Creating a cluster action

Creating an analyzer plugin

Creating a river plugin