Filter_path usage

I have used templates to tune the number of replicas and over time I've a number of templates. I don't remember the exact names.

GET _template gives very verbose output because of a huge number of internal templates (starting with .). I tried filter_path but could not figure out how to use it to show only the level 1 names of the json output. e.g.

{
  "template1",
  "template2",
  ".watch...",
  ".monitoring..."
}

Additionally, how can I filter out the internal templates i.e. not show templates starting with a dot?

As you have to specify a certain field in the filter_path to filter for, and those fields are dynamic I am afraid that filter_path is not the best way to go here.

There is a swiss army knife named jq for processing json on the command line, and you can use it like this to only extract the keys

curl 'localhost:9200/_template?pretty' | jq 'keys'

--Alex

Thanks Alex! I was not aware of jq - looks powerful. However need to use the command line instead of dev tools console.

I also discovered cat templates which gives a much cleaner output that I can use to discover my templates.

jq is a commandline tool, but the cat templates API is indeed the better solution. fully forgot about that for a second :slight_smile: