Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
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
€45.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
Table of content icon View table of contents Preview book icon Preview Book

ElasticSearch Cookbook - Second Edition

Chapter 1. Getting Started

In this chapter, we will cover:

  • Understanding nodes and clusters
  • Understanding node services
  • Managing your data
  • Understanding clusters, replication, and sharding
  • Communicating with ElasticSearch
  • Using the HTTP protocol
  • Using the native protocol
  • Using the Thrift protocol

Introduction

To efficiently use ElasticSearch, it is very important to understand how it works.

The goal of this chapter is to give the readers an overview of the basic concepts of ElasticSearch and to be a quick reference for them. It's essential to understand the basics better so that you don't fall into the common pitfall about how ElasticSearch works and how to use it.

The key concepts that we will see in this chapter are: node, index, shard, mapping/type, document, and field.

ElasticSearch can be used both as a search engine as well as a data store.

A brief description of the ElasticSearch logic helps the user to improve performance, search quality, and decide when and how to optimize the infrastructure to improve scalability and availability.

Some details on data replications and base node communication processes are also explained.

At the end of this chapter, the protocols used to manage ElasticSearch are also discussed.

Understanding nodes and clusters

Every instance of ElasticSearch is called a node. Several nodes are grouped in a cluster. This is the base of the cloud nature of ElasticSearch.

Getting ready

To better understand the following sections, some basic knowledge about the concepts of the application node and cluster are required.

How it works...

One or more ElasticSearch nodes can be set up on a physical or a virtual server depending on the available resources such as RAM, CPU, and disk space.

A default node allows you to store data in it to process requests and responses. (In Chapter 2, Downloading and Setting Up, we'll see details about how to set up different nodes and cluster topologies).

When a node is started, several actions take place during its startup, such as:

  • The configuration is read from the environment variables and the elasticsearch.yml configuration file
  • A node name is set by the configuration file or is chosen from a list of built-in random names
  • Internally, the ElasticSearch engine initializes all the modules and plugins that are available in the current installation

    Tip

    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

After the node startup, the node searches for other cluster members and checks its index and shard status.

To join two or more nodes in a cluster, the following rules must be observed:

  • The version of ElasticSearch must be the same (v0.20, v0.9, v1.4, and so on) or the join is rejected.
  • The cluster name must be the same.
  • The network must be configured to support broadcast discovery (it is configured to it by default) and they can communicate with each other. (See the Setting up networking recipe in Chapter 2, Downloading and Setting Up.)

A common approach in cluster management is to have a master node, which is the main reference for all cluster-level actions, and the other nodes, called secondary nodes, that replicate the master data and its actions.

To be consistent in the write operations, all the update actions are first committed in the master node and then replicated in the secondary nodes.

In a cluster with multiple nodes, if a master node dies, a master-eligible node is elected to be the new master node. This approach allows automatic failover to be set up in an ElasticSearch cluster.

There's more...

There are two important behaviors in an ElasticSearch node: the non-data node (or arbiter) and the data container behavior.

Non-data nodes are able to process REST responses and all other operations of search. During every action execution, ElasticSearch generally executes actions using a map/reduce approach: the non-data node is responsible for distributing the actions to the underlying shards (map) and collecting/aggregating the shard results (redux) to be able to send a final response. They may use a huge amount of RAM due to operations such as facets, aggregations, collecting hits and caching (such as scan/scroll queries).

Data nodes are able to store data in them. They contain the indices shards that store the indexed documents as Lucene (internal ElasticSearch engine) indices.

Using the standard configuration, a node is both an arbiter and a data container.

In big cluster architectures, having some nodes as simple arbiters with a lot of RAM, with no data, reduces the resources required by data nodes and improves performance in searches using the local memory cache of arbiters.

See also

  • The Setting up different node types recipe in Chapter 2, Downloading and Setting Up.

Understanding node services

When a node is running, a lot of services are managed by its instance. These services provide additional functionalities to a node and they cover different behaviors such as networking, indexing, analyzing and so on.

Getting ready

Every ElasticSearch server that is running provides services.

How it works...

ElasticSearch natively provides a large set of functionalities that can be extended with additional plugins.

During a node startup, a lot of required services are automatically started. The most important are:

  • Cluster services: These manage the cluster state, intra-node communication, and synchronization.
  • Indexing Service: This manages all indexing operations, initializing all active indices and shards.
  • Mapping Service: This manages the document types stored in the cluster (we'll discuss mapping in Chapter 3, Managing Mapping).
  • Network Services: These are services such as HTTP REST services (default on port 9200), internal ES protocol (port 9300) and the Thrift server (port 9500), applicable only if the Thrift plugin is installed.
  • Plugin Service: This enables us to enhance the basic ElasticSearch functionality in a customizable manner. (It's discussed in Chapter 2, Downloading and Setting Up, for installation and Chapter 12, Plugin Development, for detailed usage.)
  • River Service: It is a pluggable service running within ElasticSearch cluster, pulling data (or being pushed with data) that is then indexed into the cluster. (We'll see it in Chapter 8, Rivers.)
  • Language Scripting Services: They allow you to add new language scripting support to ElasticSearch.

    Note

    Throughout this book, we'll see recipes that interact with ElasticSearch services. Every base functionality or extended functionality is managed in ElasticSearch as a service.

Managing your data

If you are going to use ElasticSearch as a search engine or a distributed data store, it's important to understand concepts of how ElasticSearch stores and manages your data.

Getting ready

To work with ElasticSearch data, a user must have basic concepts of data management and JSON data format, which is the lingua franca to work with ElasticSearch data and services.

How it works...

Our main data container is called index (plural indices) and it can be considered as a database in the traditional SQL world. In an index, the data is grouped into data types called mappings in ElasticSearch. A mapping describes how the records are composed (fields).

Every record that must be stored in ElasticSearch must be a JSON object.

Natively, ElasticSearch is a schema-less data store; when you enter records in it during the insert process it processes the records, splits it into fields, and updates the schema to manage the inserted data.

To manage huge volumes of records, ElasticSearch uses the common approach to split an index into multiple shards so that they can be spread on several nodes. Shard management is transparent to the users; all common record operations are managed automatically in the ElasticSearch application layer.

Every record is stored in only a shard; the sharding algorithm is based on a record ID, so many operations that require loading and changing of records/objects, can be achieved without hitting all the shards, but only the shard (and its replica) that contains your object.

The following schema compares ElasticSearch structure with SQL and MongoDB ones:

ElasticSearch

SQL

MongoDB

Index (Indices)

Database

Database

Shard

Shard

Shard

Mapping/Type

Table

Collection

Field

Field

Field

Object (JSON Object)

Record (Tuples)

Record (BSON Object)

There's more...

To ensure safe operations on index/mapping/objects, ElasticSearch internally has rigid rules about how to execute operations.

In ElasticSearch, the operations are divided into:

  • Cluster/index operations: All clusters/indices with active write are locked; first they are applied to the master node and then to the secondary one. The read operations are typically broadcasted to all the nodes.
  • Document operations: All write actions are locked only for the single hit shard. The read operations are balanced on all the shard replicas.

When a record is saved in ElasticSearch, the destination shard is chosen based on:

  • The id (unique identifier) of the record; if the id is missing, it is autogenerated by ElasticSearch
  • If routing or parent (we'll see it in the parent/child mapping) parameters are defined, the correct shard is chosen by the hash of these parameters

Splitting an index in shard allows you to store your data in different nodes, because ElasticSearch tries to balance the shard distribution on all the available nodes.

Every shard can contain up to 2^32 records (about 4.9 billion), so the real limit to a shard size is its storage size.

Shards contain your data and during search process all the shards are used to calculate and retrieve results. So ElasticSearch performance in big data scales horizontally with the number of shards.

All native records operations (such as index, search, update, and delete) are managed in shards.

Shard management is completely transparent to the user. Only an advanced user tends to change the default shard routing and management to cover their custom scenarios. A common custom scenario is the requirement to put customer data in the same shard to speed up his operations (search/index/analytics).

Best practices

It's best practice not to have a shard too big in size (over 10 GB) to avoid poor performance in indexing due to continuous merging and resizing of index segments.

It is also not good to over-allocate the number of shards to avoid poor search performance due to native distributed search (it works as map and reduce). Having a huge number of empty shards in an index will consume memory and increase the search times due to an overhead on network and results aggregation phases.

Understanding clusters, replication, and sharding

Related to shard management, there is the key concept of replication and cluster status.

Getting ready

You need one or more nodes running to have a cluster. To test an effective cluster, you need at least two nodes (that can be on the same machine).

How it works...

An index can have one or more replicas; the shards are called primary if they are part of the primary replica, and secondary ones if they are part of replicas.

To maintain consistency in write operations, the following workflow is executed:

  • The write operation is first executed in the primary shard
  • If the primary write is successfully done, it is propagated simultaneously in all the secondary shards
  • If a primary shard becomes unavailable, a secondary one is elected as primary (if available) and then the flow is re-executed

During search operations, if there are some replicas, a valid set of shards is chosen randomly between primary and secondary to improve its performance. ElasticSearch has several allocation algorithms to better distribute shards on nodes. For reliability, replicas are allocated in a way that if a single node becomes unavailable, there is always at least one replica of each shard that is still available on the remaining nodes.

The following figure shows some examples of possible shards and replica configuration:

How it works...

The replica has a cost in increasing the indexing time due to data node synchronization, which is the time spent to propagate the message to the slaves (mainly in an asynchronous way).

Note

To prevent data loss and to have high availability, it's good to have a least one replica; so your system can survive a node failure without downtime and without loss of data.

There's more...

Related to the concept of replication, there is the cluster status indicator that will show you information on the health of your cluster. It can cover three different states:

  • Green: This shows that everything is okay
  • Yellow: This means that some shards are missing but you can work on your cluster
  • Red: This indicates a problem as some primary shards are missing

Solving the yellow status...

Mainly, yellow status is due to some shards that are not allocated.

If your cluster is in the recovery status (meaning that it's starting up and checking the shards before they are online), you need to wait until the shards' startup process ends.

After having finished the recovery, if your cluster is always in the yellow state, you may not have enough nodes to contain your replicas (for example, maybe the number of replicas is bigger than the number of your nodes). To prevent this, you can reduce the number of your replicas or add the required number of nodes. A good practice is to observe that the total number of nodes must not be lower than the maximum number of replicas present.

Solving the red status

This means you are experiencing lost data, the cause of which is that one or more shards are missing.

To fix this, you need to try to restore the node(s) that are missing. If your node restarts and the system goes back to the yellow or green status, then you are safe. Otherwise, you have obviously lost data and your cluster is not usable; the next action would be to delete the index/indices and restore them from backups or snapshots (if you have done them) or from other sources. To prevent data loss, I suggest having always a least two nodes and a replica set to 1 as good practice.

Note

Having one or more replicas on different nodes on different machines allows you to have a live backup of your data, which stays updated always.

See also

Setting up different node types in the next chapter.

Communicating with ElasticSearch

You can communicate with several protocols using your ElasticSearch server. In this recipe, we will take a look at the main protocols.

Getting ready

You will need a working instance of the ElasticSearch cluster.

How it works...

ElasticSearch is designed to be used as a RESTful server, so the main protocol is the HTTP, usually on port number 9200 and above. Thus, it allows using different protocols such as native and thrift ones.

Many others are available as extension plugins, but they are seldom used, such as memcached, couchbase, and websocket. (If you need to find more on the transport layer, simply type in Elasticsearch transport on the GitHub website to search.)

Every protocol has advantages and disadvantages. It's important to choose the correct one depending on the kind of applications you are developing. If you are in doubt, choose the HTTP Protocol layer that is the standard protocol and is easy to use.

Choosing the right protocol depends on several factors, mainly architectural and performance related. This schema factorizes advantages and disadvantages related to them. If you are using any of the protocols to communicate with ElasticSearch official clients, switching from a protocol to another is generally a simple setting in the client initialization.

Protocol

Advantages

Disadvantages

Type

HTTP

  • Frequently used
  • API is safe and has general compatibility for different versions of ES, although JSON is suggested
  • HTTP overhead
  • Text

Native

  • Fast network layer
  • Programmatic
  • Best for massive indexing operations
  • If the API changes, it can break the applications
  • Requires the same version of the ES server
  • Only on JVM
  • Binary

Thrift

  • Similar to HTTP
  • Related to the Thrift plugin
  • Binary

Using the HTTP protocol

This recipe shows us the usage of the HTTP protocol with an example.

Getting ready

You need a working instance of the ElasticSearch cluster. Using default configuration, ElasticSearch enables port number 9200 on your server to communicate in HTTP.

How to do it...

The standard RESTful protocol is easy to integrate.

We will see how easy it is to fetch the ElasticSearch greeting API on a running server on port 9200 using different programming languages:

  • In BASH, the request will be:
    curl –XGET http://127.0.0.1:9200
    
  • In Python, the request will be:
    import urllib
    result = urllib.open("http://127.0.0.1:9200")
  • In Java, the request will be:
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    … truncated…
      try{  // get URL content
        URL url = new URL("http://127.0.0.1:9200");
        URLConnection conn = url.openConnection();// open the stream and put it into BufferedReader
        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    
        String inputLine;
        while ((inputLine = br.readLine()) != null){
        System.out.println(inputLine);
      }
      br.close();
      System.out.println("Done");
    }
      Catch (MalformedURLException e) {
      e.printStackTrace();
    }
    catch (IOException e){
      e.printStackTrace();
    }
  • In Scala, the request will be:
    scala.io.Source.fromURL("http://127.0.0.1:9200","utf-8").getLines.mkString("\n")

For every language sample, the response will be the same:

{
  "ok" : true,
  "status" : 200,
  "name" : "Payge, Reeva",
  "version" : {
    "number" : "1.4.0",
    "snapshot_build" : false
  },
  "tagline" : "You Know, for Search"
}

How it works...

Every client creates a connection to the server index / and fetches the answer. The answer is a valid JSON object. You can invoke the ElasticSearch server from any language that you like.

The main advantages of this protocol are:

  • Portability: This uses Web standards so that it can be integrated in different languages (Erlang, JavaScript, Python, Ruby, and so on) or called via a command-line application such as cURL.
  • Durability: The REST APIs don't change often. They don't break for minor release changes as native protocol does.
  • Simple to use: This has JSON-to-JSON interconnectivity.
  • Good support: This has much more support than other protocols. Every plugin typically supports a REST endpoint on HTTP.
  • Easy cluster scaling: You can simply put your cluster nodes behind an HTTP load balancer to balance the calls such as HAProxy or NGinx.

In this book, a lot of the examples are done by calling the HTTP API via the command-line cURL program. This approach is very fast and allows you to test functionalities very quickly.

There's more...

Every language provides drivers for best integration with ElasticSearch or RESTful web services.

The ElasticSearch community provides official drivers that support the most used programming languages.

Using the native protocol

ElasticSearch provides a native protocol, used mainly for low-level communication between nodes, but very useful for fast importing of huge data blocks. This protocol is available only for Java Virtual Machine (JVM) languages and commonly is used in Java, Groovy, and Scala.

Getting ready

You need a working instance of the ElasticSearch cluster; the standard port number for native protocol is 9300.

How to do it...

The following are the steps required to use the native protocol in a Java environment (we'll discuss this in depth in Chapter 10, Java Integration):

  1. Before starting, we must be sure that Maven loads the Elasticsearch.jar file by adding the following code to the pom.xml file:
    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>1.4.1</version>
    </dependency>
  2. Depending on the Elasticsearch.jar file, creating a Java client is quite easy:
    import org.elasticsearch.common.settings.ImmutableSettings;
    import org.elasticsearch.common.settings.Settings;
    import org.elasticsearch.client.Client;
    import org.elasticsearch.client.transport.TransportClient;
    …
    Settings settings = ImmutableSettings.settingsBuilder()
    .put("client.transport.sniff", true).build();
      // we define a new settings
      // using sniff transport allows to autodetect other nodes
    Client client = new TransportClient(settings)
      .addTransportAddress(new InetSocketTransportAddress("127.0.0.1", 9300));
      // a client is created with the settings

How it works...

To initialize a native client, a settings object is required, which contains some configuration parameters. The most important ones are:

  • cluster.name: This is the name of the cluster
  • client.transport.sniff: This allows you to sniff out the rest of the cluster and add them into its list of machines to use

With the settings object, it's possible to initialize a new client by giving an IP address and port a number (default 9300).

There's more...

The native protocol is the internal one used in ElasticSearch. It's the fastest protocol that is available to communicate with ElasticSearch.

The native protocol is an optimized binary and works only for JVM languages; to use this protocol, you need to include the elasticsearch.jar in your JVM project. Because it depends on ElasticSearch implementation, it must be the same version of ElasticSearch cluster.

For this reason, every time you update ElasticSearch, you need to update the elasticsearch.jar file on which it depends and if there are internal API changes, you need to update your code.

To use this protocol, you need to study the internals of ElasticSearch, so it's not as easy to use as HTTP and Thrift protocol.

Native protocol is useful for massive data import. But as ElasticSearch is mainly thought as a REST HTTP server to communicate with, it lacks support for everything that is not standard in the ElasticSearch core, such as the plugin's entry points. So using this protocol, you are unable to call entry points made by external plugins.

Note

The native protocol seems the most easy to integrate in a Java/JVM project. However, due to its nature that follows the fast release cycles of ElasticSearch, it changes very often. Also, for minor release upgrades, your code is more likely to be broken. Thus, ElasticSearch developers wisely tries to fix them in the latest releases.

See also

Using the Thrift protocol

Thrift is an interface definition language, initially developed by Facebook, used to define and create services. This protocol is now maintained by Apache Software Foundation.

Its usage is similar to HTTP, but it bypasses the limit of HTTP protocol (latency, handshake and so on) and it's faster.

Getting ready

You need a working instance of ElasticSearch cluster with the thrift plugin installed (https://github.com/elasticsearch/elasticsearch-transport-thrift/); the standard port for the Thrift protocol is 9500.

How to do it...

To use the Thrift protocol in a Java environment, perform the following steps:

  1. We must be sure that Maven loads the thrift library adding to the pom.xml file; the code lines are:
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>0.9.1</version>
    </dependency>
  2. In Java, creating a client is quite easy using ElasticSearch generated classes:
    import org.apache.thrift.protocol.TBinaryProtocol;
    import org.apache.thrift.protocol.TProtocol;
    import org.apache.thrift.transport.TSocket;
    import org.apache.thrift.transport.TTransport;
    import org.apache.thrift.transport.TTransportException;
    import org.elasticsearch.thrift.*;
    TTransport transport = new TSocket("127.0.0.1", 9500);
    TProtocol protocol = new TBinaryProtocol(transport);
    Rest.Client client = new Rest.Client(protocol);
    transport.open();
  3. To initialize a connection, first we need to open a socket transport. This is done with the TSocket(host, port) setting, using the ElasticSearch thrift standard port 9500.
  4. Then the socket transport protocol must be encapsulated in a binary protocol, this is done with the TBinaryProtocol(transport) parameter.
  5. Now, a client can be initialized by passing the protocol. The Rest.Client utility class and other utility classes are generated by elasticsearch.thrift. It resides in the org.elasticsearch.thrift namespace.
  6. To have a fully working client, we must open the socket (transport.open()).
  7. At the end of program, we should close the client connection (transport.close()).

There's more...

Some drivers, to connect to ElasticSearch, provide an easy-to-use API to interact with Thrift without the boulder that this protocol needs.

For advanced usage, I suggest the use of the Thrift protocol to bypass some problems related to HTTP limits, such as:

  • The number of simultaneous connections required in HTTP; Thrift transport efficiently uses resources
  • The network traffic is light weight because it is binary and is very compact

A big advantage of this protocol is that on the server side it wraps the REST entry points so that it can also be used with calls provided by external REST plugins.

See also

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
Estimated delivery fee Deliver to Malta

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

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 : 9781783554836
Vendor :
Elastic
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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
Estimated delivery fee Deliver to Malta

Premium delivery 7 - 10 business days

€32.95
(Includes tracking information)

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 133.97
Elasticsearch Server: Second Edition
€41.99
Mastering Elasticsearch - Second Edition
€45.99
ElasticSearch Cookbook - Second Edition
€45.99
Total 133.97 Stars icon

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

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela