Managing scripts
Depending on your scripting usage, there are several ways to customize ElasticSearch to use your script extensions.
In this recipe, we will see how to provide scripts to ElasticSearch via files, indexes, or inline.
Getting ready
You will need a working ElasticSearch cluster populated with the
populate
script (chapter_06/populate_aggregations.sh
) used in Chapter 6, Aggregations, available at https://github.com/aparo/elasticsearch-cookbook-second-edition.
How to do it...
To manage scripting, perform the following steps:
- Dynamic scripting is disabled by default for security reasons; we need to activate it in order to use dynamic scripting languages such as JavaScript or Python. To do this, we need to turn off the disable flag (
script.disable_dynamic: false
) in the ElasticSearch configuration file (config/elasticseach.yml
) and restart the cluster. - To increase security, ElasticSearch does not allow you to specify scripts for non-sandbox languages. Scripts can be placed in the
scripts...