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

elasticsearch, elasticsearch-5, search, templates

Solution

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"`.

Problem

It appears the `.scripts` index no longer exists in this version, so I cannot just do `http:\\<elasticsearchserver>:9200\.scripts\_search`. According to the docs, scripts should be in the `config\scripts` directory, but the `\etc\elasticsearch\scripts` folder is empty in my environment. I have one template created at the moment, so it seems to me that something should be in there.

Original source