How to list all scripts/templates when GET _cat/templates doesn't return them

I am new to ES ... I am looking at the existing codes which my team is using

es.put_script("my_custom_template_1_id", my_custom_template_1_query)

I can retrieve the the template info by using the SPECIFIC template id like this

POST _render/template
{
  "id": "my_custom_template_1_id",
  "params": {
        "searchterm": "whatever",
    }
}

or

es.get_script(my_custom_template_1_id)

But I can't find a way to list the all template IDs. I've tried all the "template" api from kibana, it lists something but not the my_custom_template_1_id.Here is the output I got when calling GET _cat/templates

tenant_template [.kibana_-*_*, .kibana_0*_*, .kibana_1*_*, .kibana_2*_*, .kibana_3*_*, .kibana_4*_*] 0  

I don't know whether it is file based index/template or not which I found it is NOT supported ... anyhow, is there any way for me to list all the my_custom_template_1_id, my_custom_template_2_id and etc??

ES Version = 7.10

try it.

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

Awesome! It works!! Thank you!!

1 Like