-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Elasticsearch 5.x Cookbook
By :

Elasticsearch allows us to define complex expressions that can be used to return a new calculated field value.
These special fields are called script_fields
, and they can be expressed with a script in every available Elasticsearch scripting language.
You need an up-and-running Elasticsearch installation as we described the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.
To execute curl
via the command-line you need to install curl
for your operating system.
To correctly execute the following commands, you need an index populated with the script chapter_09/populate_for_scripting.sh
script available in the online code.
For computing return fields with scripting, we will perform the following steps:
Return the following script fields:
"my_calc_field"
: This concatenates the texts of the "name"
and "description"
fields
"my_calc_field2"
: This multiplies the "price"
value by the "discount"
parameter
From...
Change the font size
Change margin width
Change background colour