10

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/
billkw
  • 3,350
  • 3
  • 28
  • 32

2 Answers2

30

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
jetnet
  • 571
  • 5
  • 8
  • Nice! I had been filtering all on the client side, but it's always great to trim that response on the server if possible. – billkw Sep 20 '18 at 12:44
  • curl version: `curl -X GET "localhost:9200/_cluster/state/metadata?pretty&filter_path=**.stored_scripts"` – Catalin Dec 13 '21 at 10:26
2

Per the Elastic forums, this content is embedded in the response to GET _cluster/state/metadata

billkw
  • 3,350
  • 3
  • 28
  • 32