resolve.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. [[indices-resolve-index-api]]
  2. === Resolve index API
  3. ++++
  4. <titleabbrev>Resolve index</titleabbrev>
  5. ++++
  6. Resolves the specified name(s) and/or index patterns for indices, aliases, and
  7. data streams. Multiple patterns and remote clusters are supported.
  8. ////
  9. [source,console]
  10. ----
  11. PUT /foo_closed
  12. POST /foo_closed/_close
  13. PUT /remotecluster-bar-01
  14. PUT /freeze-index
  15. PUT /my-index-000001
  16. PUT /freeze-index/_alias/f-alias
  17. PUT /my-index-000001/_alias/f-alias
  18. PUT /_index_template/foo_data_stream
  19. {
  20. "index_patterns": [ "foo" ],
  21. "data_stream": { }
  22. }
  23. PUT /_data_stream/foo
  24. ----
  25. // TESTSETUP
  26. [source,console]
  27. ----
  28. DELETE /_data_stream/*
  29. DELETE /_index_template/foo_data_stream
  30. ----
  31. // TEARDOWN
  32. ////
  33. [source,console]
  34. ----
  35. GET /_resolve/index/my-index-*
  36. ----
  37. // TEST[skip:unable to ignore deprecation warning]
  38. [[resolve-index-api-request]]
  39. ==== {api-request-title}
  40. `GET /_resolve/index/<name>`
  41. [[resolve-index-api-prereqs]]
  42. ==== {api-prereq-title}
  43. * If the {es} {security-features} are enabled, you must have the
  44. `view_index_metadata` or `manage` <<privileges-list-indices,index privilege>>
  45. for the target data stream, index, or index alias.
  46. [[resolve-index-api-path-params]]
  47. ==== {api-path-parms-title}
  48. `<name>`::
  49. +
  50. --
  51. (Required, string) Comma-separated name(s) or index pattern(s) of the
  52. indices, aliases, and data streams to resolve. Resources on
  53. <<remote-clusters,remote clusters>> can be specified using the
  54. `<cluster>:<name>` syntax.
  55. --
  56. [[resolve-index-api-query-params]]
  57. ==== {api-query-parms-title}
  58. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
  59. +
  60. Defaults to `open`.
  61. [[resolve-index-api-example]]
  62. ==== {api-examples-title}
  63. [source,console]
  64. ----
  65. GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all
  66. ----
  67. // TEST[continued]
  68. // TEST[s/remoteCluster1:/remotecluster-/]
  69. The API returns the following response:
  70. [source,console-result]
  71. ----
  72. {
  73. "indices": [ <1>
  74. {
  75. "name": "foo_closed",
  76. "attributes": [
  77. "closed"
  78. ]
  79. },
  80. {
  81. "name": "freeze-index",
  82. "aliases": [
  83. "f-alias"
  84. ],
  85. "attributes": [
  86. "open"
  87. ]
  88. },
  89. {
  90. "name": "remoteCluster1:bar-01",
  91. "attributes": [
  92. "open"
  93. ]
  94. }
  95. ],
  96. "aliases": [ <2>
  97. {
  98. "name": "f-alias",
  99. "indices": [
  100. "freeze-index",
  101. "my-index-000001"
  102. ]
  103. }
  104. ],
  105. "data_streams": [ <3>
  106. {
  107. "name": "foo",
  108. "backing_indices": [
  109. ".ds-foo-2099.03.07-000001"
  110. ],
  111. "timestamp_field": "@timestamp"
  112. }
  113. ]
  114. }
  115. ----
  116. // TESTRESPONSE[s/remoteCluster1:/remotecluster-/]
  117. // TESTRESPONSE[s/.ds-foo-2099.03.07-000001/$body.data_streams.0.backing_indices.0/]
  118. <1> All indices matching the supplied names or expressions
  119. <2> All aliases matching the supplied names or expressions
  120. <3> All data streams matching the supplied names or expressions