templates.asciidoc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. [[cat-templates]]
  2. == cat templates
  3. The `templates` command provides information about existing templates.
  4. [source,js]
  5. --------------------------------------------------
  6. GET /_cat/templates?v&s=name
  7. --------------------------------------------------
  8. // CONSOLE
  9. // TEST[s/templates/templates\/template*/]
  10. // TEST[s/^/PUT _template\/template0\n{"index_patterns": "te*", "order": 0}\n/]
  11. // TEST[s/^/PUT _template\/template1\n{"index_patterns": "tea*", "order": 1}\n/]
  12. // TEST[s/^/PUT _template\/template2\n{"index_patterns": "teak*", "order": 2, "version": 7}\n/]
  13. // The substitutions do two things:
  14. // 1. Filter the response to just templates matching the te* pattern
  15. // so that we only get the templates we expect regardless of which
  16. // templates exist. If xpack is installed there will be unexpected
  17. // templates.
  18. // 2. Create some templates to expect in the response.
  19. which looks like
  20. [source,txt]
  21. --------------------------------------------------
  22. name index_patterns order version
  23. template0 [te*] 0
  24. template1 [tea*] 1
  25. template2 [teak*] 2 7
  26. --------------------------------------------------
  27. // TESTRESPONSE[s/\*/\\*/ s/\[/\\[/ s/\]/\\]/ _cat]
  28. The output shows that there are three existing templates,
  29. with template2 having a version value.
  30. The endpoint also supports giving a template name or pattern in the url
  31. to filter the results, for example `/_cat/templates/template*` or
  32. `/_cat/templates/template0`.