In Chapter 5, Search, Queries, and Filters, we have seen many filters. ElasticSearch scripting allows extending the traditional filter with custom script.
Using scripting to create a custom filter is a convenient way to write scripting rules not provided by Lucene or ElasticSearch and to create business rules not available in query DSL.
You need a working ElasticSearch cluster and an index, populated with the script used for facet processing, available in the online code.
For filtering a search using a scripting, we will perform the following steps:
We'll write a search with a filter that filters out a document with an age value less than a parameter value:
curl -XGET 'http://127.0.0.1:9200/test-index/test-type/_search?&pretty=true&size=3' -d '{ "query": { "filtered": { "filter": { "script": { "script": "doc[\"age\"].value > param1", "params" : { "param1" : 80 ...