-
Book Overview & Buying
-
Table Of Contents
ElasticSearch Server
ElasticSearch has a few functionalities where scripts can be used. You've already seen examples such as updating documents, filtering, and searching. Regardless of the fact that this seems to be advanced, we will take a look at the possibilities given by ElasticSearch. Looking into any request that use scripts, we can spot several fields:
script: This field contains the script code.
lang: This field informs the engine which language is used. If it is omitted, ElasticSearch assumes mvel.
params: This is an object containing parameters. Every defined parameter is available for script by its name. By using parameters, we can write cleaner code. Due to caching, code with parameters performs better than code with embedded constant values.
During the execution of the script, ElasticSearch exposes several objects. The ones available for operations connected with searching are as follows:
doc (also available as _doc): This is an instance of the org.elasticsearch.search...
Change the font size
Change margin width
Change background colour