Search code examples
elasticsearchelasticsearch-painless

How do I list all stored scripts on an Elasticsearch cluster?


I would like to be able to list all of the scripts stored on a given Elasticsearch cluster.

The elasticsearch documentation has clear examples for how to create, retrieve, use and delete a script with a particular name. Unfortunately, there is no mention of a list endpoint.

The following do not work (at least in Elasticsearch 5.4.1):

  • GET _cat/scripts
  • GET _scripts
  • GET _scripts/

Solution

  • as the metadata output could be huge, use the filter_path to display the scripts only:

    GET _cluster/state/metadata?pretty&filter_path=**.stored_scripts