How do I get a list of Search Templates in Elasticsearch 5.x? How do I get a list of Search Templates in Elasticsearch 5.x? elasticsearch elasticsearch

How do I get a list of Search Templates in Elasticsearch 5.x?


I found that when you add a Search Template via the API, it is stored in the cluster state, and you can get the list in /_cluster/state under "metadata"->"stored_scripts".


For me, the "code" under some of our templates were massive, obscuring the names of the templates, which is all I wanted. This snippet will parse just the template names using the jq utility: curl 'localhost:9200/_cluster/state' | jq '.metadata.stored_scripts | keys'