alias.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. [[cat-alias]]
  2. === cat aliases API
  3. ++++
  4. <titleabbrev>cat aliases</titleabbrev>
  5. ++++
  6. .New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cat[Compact and aligned text (CAT) APIs]..
  10. --
  11. [IMPORTANT]
  12. ====
  13. cat APIs are only intended for human consumption using the command line or the
  14. {kib} console. They are _not_ intended for use by applications. For application
  15. consumption, use the <<aliases,aliases API>>.
  16. ====
  17. Retrieves the cluster's <<aliases,index aliases>>, including filter and routing
  18. information. The API does not return data stream aliases.
  19. [[cat-alias-api-request]]
  20. ==== {api-request-title}
  21. `GET _cat/aliases/<alias>`
  22. `GET _cat/aliases`
  23. [[cat-alias-api-prereqs]]
  24. ==== {api-prereq-title}
  25. * If the {es} {security-features} are enabled, you must have the
  26. `view_index_metadata` or `manage` <<privileges-list-indices,index privilege>>
  27. for any alias you retrieve.
  28. [[cat-alias-api-path-params]]
  29. ==== {api-path-parms-title}
  30. `<alias>`::
  31. (Optional, string) Comma-separated list of aliases to retrieve. Supports
  32. wildcards (`*`). To retrieve all aliases, omit this parameter or use `*` or
  33. `_all`.
  34. [[cat-alias-api-query-params]]
  35. ==== {api-query-parms-title}
  36. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  37. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  38. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=help]
  39. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=local]
  40. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  41. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  42. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  43. [[cat-alias-api-example]]
  44. ==== {api-examples-title}
  45. ////
  46. Hidden setup for example:
  47. [source,console,id=cat-aliases-example]
  48. ----
  49. PUT test1
  50. {
  51. "aliases": {
  52. "alias1": {},
  53. "alias2": {
  54. "filter": {
  55. "match": {
  56. "user.id": "kimchy"
  57. }
  58. }
  59. },
  60. "alias3": {
  61. "routing": "1"
  62. },
  63. "alias4": {
  64. "index_routing": "2",
  65. "search_routing": "1,2"
  66. }
  67. }
  68. }
  69. ----
  70. ////
  71. [source,console]
  72. ----
  73. GET _cat/aliases?v=true
  74. ----
  75. // TEST[continued]
  76. The API returns the following response:
  77. [source,txt]
  78. ----
  79. alias index filter routing.index routing.search is_write_index
  80. alias1 test1 - - - -
  81. alias2 test1 * - - -
  82. alias3 test1 - 1 1 -
  83. alias4 test1 - 2 1,2 -
  84. ----
  85. // TESTRESPONSE[s/[*]/[*]/ non_json]
  86. This response shows that `alias2` has configured a filter, and specific routing
  87. configurations in `alias3` and `alias4`.
  88. If you only want to get information about specific aliases, you can specify
  89. the aliases in comma-delimited format as a URL parameter, e.g.,
  90. /_cat/aliases/alias1,alias2.