Category Archives: Tutorial

Creating Custom ElasticSearch REST Action

Send to Kindle

code

The Mastering ElasticSearch book that is going to be published in December 2013 (probable date, but may be available earlier) will include a chapter that is dedicated to extending ElasticSearch. However, one of the topics – the simplest one didn’t made it into the book. Because of that we wanted to share this section of the book on the blog. We hope that you’ll find it useful.

Continue reading

Reroute API explained

Send to Kindle

routeTill now, we didn’t talk about shard allocation process or ability to move shards around the cluster. If you recall what shard allocation is – the process of allocating shards to nodes which can happen during initial cluster start, during replicas allocation or when nodes are being removed or added to the cluster. However apart from the allocation mechanism control, sometimes it is crucial to be able to cancel shard allocation or move shards around inside the cluster. In order to do that ElasticSearch exposes the reroute API, which allows us to move shards, cancel their allocation and finally force the allocation. You can imagine a situation when you would like to take off a single node from your cluster for maintenance, but you have data on it and first you want to somehow move the data to some other node. This is where the reroute API can come in handy. So now, let’s discuss all the possibilities that give us.

Continue reading

Tagged , , ,

ElasticSearch 0.90 – Search Shards API

Send to Kindle

searchElasticSearch is designed to work with indices that are built of multiple shards and replicas and you probably have such indices in your cluster. Sometimes it may be handy to see which shard will the query be exectued at. Before ElasticSearch 0.90 you could run a query and check the stats to see that, but now we can use the Search Shards API. Let’s look on how we can use this API by using a simple example and queries that does and doesn’t use routing.

Continue reading

Tagged , , ,

ElasticSearch 0.90.3 – cat API

Send to Kindle

textWith the incoming release of ElasticSearch 0.90.3 we will get a new maintenance API, a one that is able to return cluster and node related information in plain text format, not in JSON. It can come useful when working with your cluster from command line – for example when you don’t want to analyze the whole JSON output, but you are only interested in some of the information returned. Let’s have a look how this API looks like.

Continue reading

ElasticSearch 0.90 – Sorting Inside Nested Objects

Send to Kindle

nestedIn addition to the ability to control what value is taken into consideration when sorting on multi-valued fields, ElasticSearch 0.90.0.Beta1 introduced another sorting improvement – ability to sort on the basis of the fields inside the nested objects. We can chose a path, a filter that will narrow the nested objects, and like in the sort_mode property (just like in the post describing multi-valued fields sorting).

Continue reading

Tagged , , ,

ElasticSearch 0.90.1: Updates in bulk API

Send to Kindle

bulkAs the 0.90.0 ElasticSearch is released it is time to look at the features that will became part of the incoming 0.90.1 and the big 1.0 release. The first thing that we payed attention to is the possibility of including partial document updates in the Bulk API request. So in addition to the standard index and delete command the ElasticSearch 0.90.1 will introduce the update one.

Continue reading

Tagged , , , ,

ElasticSearch 0.90 – Stored fields and term vectors compression

Send to Kindle

compressThe newest release of ElasticSearch, the 0.90.0 RC1 leverages all the new features that come with Apache Lucene 4.2. The two features we will have a short look today are automatic compression of all stored fields in the index as well as term vectors compression. What does it mean for ElasticSearch ? Basically all the compression functionalities that were present in the previous ElasticSearch versions are now gone and they are turned on by default, but let’s see what it means for us.
Continue reading

ElasticSearch 0.90 – Using Rescore

Send to Kindle

signSometimes it is handy to change ordering of documents already returned by the query. The reasons for such behavior can vary. One of the reasons may be performance – for example calculating target ordering is very costly in terms of performance and we would like to do this on the subset of documents returned by the original query. At the first look rescore gives many great opportunities for business cases. This short article will verify the usefulness of this function.

Continue reading

ElasticSearch 0.90 – Sorting on Multi-Valued Fields

Send to Kindle

sortingWith the release of ElasticSearch 0.90 the users of this search engine will be able to sort on multi-valued fields and chose which value from that field to chose for sorting. Yes that’s right, till now you had to design a field especially for sorting, use scripts or multi-fields. Now, you don’t have to do anything like that. Let’s look how we can use this new functionality.

Continue reading

ElasticSearch 0.90 – Using suggester

Send to Kindle

Light BulbWhen we wrote ElasticSearch Server book, the latest available version of this search server was 0.20 (to be honest, it was 0.19 and we’ve used unreleased version).  A few days after the publication of the book we have the 0.90.0.Beta1 version available with cool, new features. One of the most important things that were introduced was the suggestion query API.  Let’s look how it works.

Continue reading