Elasticsearch Server Errata

We would like to ensure that the reception of the book should be as good as possible and because we have found some mistakes in the book we decided to write a little errata. We sincerely apologize for all the error and mistakes.

Elasticsearch Server Third Edition Errata

Chapter 2

Correction 1

In the Throttling section of the chapter, when we discuss throttling there is an information box missing telling that merge throttling can only be used up to Elasticsearch 2.0. With the release of Elasticsearch 2.0, the merge throttling is now automatic.

Elasticsearch Server Second Edition Errata

General information

With the release of Elasticsearch 1.2.0 the dynamic scripting was disabled by default. Because the book was written using Elasticsearch 1.0, this was not the case. Some of the examples in the book uses dynamic scripting and to make them work, one needs to add the following property to the elasticsearch.yml file:

script.disable_dynamic: false

Submitted by: Martin (@partymarty84)

Please also note that with the release of Elasticsearch 1.3.0 the default MVEL scripting language is now deprecated for various reasons (i.e. security). The new language of choice is Groovy. The 1.4.0 release of Elasticsearch will remove MVEL support and will introduce this language as a plug-in. Groovy can be sandboxed, which means that dynamic scripting is enabled for that language, so if you use that scripting language you can have your scripts working again.

Preface

Correction 1

On page 2, in the preface section the following sentence is present: “(…) you’ll need a command that allows you to send HTTP requests such as cURL.“. It should be “(…) you’ll need a command line tool that allows you to send HTTP requests such as cURL.“.

Chapter 1

Correction 1

On page 23 the following command is shown:

curl -XGET http://localhost:9200/_cluster/nodes/

It should be:

curl -XGET http://localhost:9200/_cluster/state/nodes/

Submitted by: Martin (@partymarty84)

Chapter 1

Correction 2

On page 30 a section about upsert and document update is present. It is falsely stating that you can upsert a field in a document during update. The correct version of the section should be as follows:

It should be:

There is one more thing about the document updates; if your script uses a field value from a document that doesn’t exists, you can set a value that will be used as the default one. For example, if you like to increment the counter field of the document and the document is not present, you can use the upsert section in your request to provide the default value that is going to be used for that field. For example, look at the following lines of command:

curl -XPOST http://localhost:9200/blog/article/1/_update -d '{
  "script": "ctx._source.counter += 1",
  "upsert": {
    "counter" : 0
  }
}'

If you execute the preceding example and the document is not present, Elasticsearch will add the document with the counter field equal to 0.

Submitted by: Martin (@partymarty84)

Chapter 2

Correction 1

In the second chapter of the book, we are showing different example of fields using that are using the precision_step property and we set it to 0. This is actually wrong, because Elasticsearch will silently ignore such defined field not throwing any error – it will just omit creating such field. Whenever the book is talking about precision_step and sets it to 0 in the example, please use the value of 8 (which is the default for integer). However, please note, that the examples will work – the precision_step can only used for numerical fields and Elasticsearch will create a proper field that have the wrong precision_step value when the data is indexed.

Submitted by: Martin (@partymarty84)

ElasticSearch Server Errata

Chapter 1

Correction 1

On page 20 there is a following text “In the preceding example, if the document we are updating doesn’t have a value in the counter field, the value of 0 will be used.“. It should be: “If the document does not already exists, the content of the upsert element will be used to index the fresh doc: (see: http://www.elasticsearch.org/guide/reference/api/update/)“.

Submitted by: Jun Ohtani (@johtani)

Correction 2

On page 24 we write about the name field, but we show the contents field. Of course this a mistake and those field names should be the same.

Found by: Ali Kaplan

Correction 3

The last section of the first chapter contains some mistakes. First of all, comma character is missing at the end of index_routing line in the example. In addition to that, the index_routing value should be the value of search_routing and vice versa, so the example should look like this:

curl -XPOST 'http://localhost:9200/_aliases' -d '{
"actions" : [
 {
  "add" : {
   "index" : "data",
   "alias" : "client",
   "search_routing" : "12345,12346,12347",
   "index_routing" : "12345"
  }
 }]
}'

The same happens to the description – in the book the following is written “For the alias named client, we will use the routing value of 12345,12346,12347 for indexing, and only 12345 for querying.“. The corrected version is “For the alias named client, we will use the routing value of 12345,12346,12347 for querying, and only 12345 for indexing.“.

Submitted by: Jun Ohtani (@johtani)

Chapter 2

Correction 1

On page 71 in the match phrase prefix query section there is a following sentence: “This query is almost the same as the prefix match query, but in addition…“. The correct sentence should be: “This query is almost the same as the phrase match query, but in addition…“.

Submitted by: Jun Ohtani (@johtani)

Correction 2

On page 73 in the description of query string query, there is a text “fizzy_min_sim“, where there should be “fuzzy_min_sim“.

Submitted by: Jun Ohtani (@johtani)

Correction 3

On page 90, in the section about Missing filter the following sentence is present: “If null_value is true, the above document hit“. This is a mistake and the correction to this sentence is as follows: “If null_value is false, the above document don’t hit“.

Submitted by: Jun Ohtani (@johtani)

Correction 4

On page 92, in the IDs section the following sentence is present: “For example, if we need to exclude a document that has 1 as the identifier, the filter would look like this:“. The mistake is that we are writing about inclusion, but we the statement says about exclusion. The corrected sentence should look like this: “For example, if we need to include a document that has 1 as the identifier, the filter would look like this:“.

Submitted by: Jun Ohtani (@johtani)

Chapter 3

Correction 1

On page 140, in the prefix query section, the following sentence is present: “(for example, into the country_code field)“. The correct sentence should be: “(for example, into the country field)“. In the proceeding example we are not using country_code field, but the country field.

Submitted by: Jun Ohtani (@johtani)

Chapter 4

Correction 1

On page 158 and 159, in the Understanding how a field is analyzed section, the following sentence is present: “…, we used the edge engram filter.”. The correct sentence should be: “…, we used the edge ngram filter.”.

Submitted by: Jun Ohtani (@johtani)

Correction 2

On page 181, in the Mappings section, the following sentence is present: “… and the title and description fields …”. The correct sentence should be: “… and the title and content fields …”.

Submitted by: Jun Ohtani (@johtani)

Chapter 6

Correction 1

On page 237 in the “Preparing the percolator” section the following query is present (query2.json):

{
 "query" : {
  "filtered": {
   "query" : {
    "range" : {
     "from" : 0,
     "year" : {
      "to" : 2010
     }
    }
   },
   "filter" : {
    "term" : {
     "available" : true
    }
   }
  }
 }
}

The from section of the range query is not properly nested, as it should be places as the child of the year object. The correct query is provided in the code with the book and should look as follows:

{
 "query" : {
  "filtered": {
   "query" : {
    "range" : {
     "year" : {
      "from": 0,
      "to" : 2010
     }
    }
   },
   "filter" : {
    "term" : {
     "available" : true
    }
   }
  }
 }
}

Submitted by: Jun Ohtani (@johtani)

Correction 2

On page 239, where the percolator functionality is discussed, the following sentence is present: “We assume that the book was returned in the branch brB;…“. The correct sentence should be “We assume that the book was returned in the branch brb;…“.

Submitted by: Jun Ohtani (@johtani)

Correction 3

On page 224 and 226, where we talk about key_field and and value_field, we used the key_value property name instead of value_field. The correct property name is value_field instead of key_value.

Submitted by: Jun Ohtani (@johtani)

Chapter 8

Correction 1

On page 282 in the “Retrieving defined warming queries” we tell about retrieving all the warming queries for a specific type in the index. Unfortunately you can’t get warmers for a specific type, but you can do it for a given index. For example, the following command will return all the warmers for the library index:

curl -XGET 'localhost:9200/library/_warmer/?pretty'
curl -XGET 'localhost:9200/library/book/_warmer/*?pretty'

Submitted by: Jun Ohtani (@johtani)

Submitting Errata

In case if you find any errors please send a mail to support(at)elasticsearchserverbook(dot)com

2 thoughts on “Elasticsearch Server Errata

Comments are closed.