Allowed script contexts list

ES: 6.1.1
NEST: 6.1

We have set our allowed script types to stored only. In reading Allowed Script Contexts, it shows a couple of examples of available contexts but I've been unable to find a comprehensive list, let alone precise descriptions of each.

So far, I have discovered by trial and error (literally, the error information that is returned from calls where my scripts are disallowed) what some of the other contexts are such as filter and aggs but I've also had to add aggs_execute which I can't differentiate from aggs. Why do I need both? Anyway, I'm assuming there's some good documentation somewhere but I haven't yet discovered it. Can anyone provide me some guidance here?

The documentation for this doesn't exist, yet (though, it's being worked on) as unfortunately scripts contexts have only begun to settle into some consistency.

Here is a list of context names in the current version - though, it's not exactly a 1:1 mapping for script usage. This is something we hope to accomplish moving forward.

analysis - AnalysisPredicateScript
painless_test - used for the Painless execute API
interval - IntervalFilterScript
aggs_execute - used to execute different aggregations (though, this has been removed from the later versions)
aggs - used for several different aggregations
bucket_aggregation - used for bucket aggregations
aggregation_selector - used for bucket aggregations
field - used for script fields
filter - used for several different types of filter scripts
processor_conditional - used for ingest condition scripts
ingest - used for ingest processor scripts
number_sort - used for scripts that use score and return a numeric value
score - used for score scripts
aggs_combine - metric aggregation combine script
aggs_init - metric aggregation init script
aggs_map - metric aggregration map script
aggs_reduce - metric aggregation reduce script
script_heuristic - signficant terms heuristic score script
similarity - scripts that change how similarity for scoring is done
similarityWeight - scripts that change the similarity weight for scoring
string_sort - sorting script that returns a string
template - template script typically used by Mustache
terms_set - TermsSetQueryScript
update_script - scripts used to update documents
moving-function - scripts used in moving function pipeline aggregations
xpack_template - template script for watcher
watcher_condition - watcher conditions scripts
watcher_transform - watcher transform scripts

I fully appreciate this feature is nebulous and frustrating to use currently.

@Jack_Conradson Thank you very much! I appreciate you clearing things up as much as can be done now and I look forward to seeing it tightened up in the future.

Can you further differentiate aggs and aggs_execute? I discovered that I had to use both (or possibly aggs_execute was the only one I really needed).

IIRC aggs_execute was the name for aggregation "value scripts". These are aggs scripts which are run on each value of an aggregation, instead of each document. Doc values (the doc variable) are not available. Instead, _value provides the current value being aggregated on, and the final value is returned by the script.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.