resolve.asciidoc 3.0 KB

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