get_index.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --
  2. :api: get-index
  3. :request: GetIndexRequest
  4. :response: GetIndexResponse
  5. --
  6. [id="{upid}-{api}"]
  7. [[java-rest-high-get-index]]
  8. === Get Index API
  9. [id="{upid}-{api}-request"]
  10. ==== Get Index Request
  11. A +{request}+ requires one or more `index` arguments:
  12. ["source","java",subs="attributes,callouts,macros"]
  13. --------------------------------------------------
  14. include-tagged::{doc-tests-file}[{api}-request]
  15. --------------------------------------------------
  16. <1> The index whose information we want to retrieve
  17. ==== Optional arguments
  18. The following arguments can optionally be provided:
  19. ["source","java",subs="attributes,callouts,macros"]
  20. --------------------------------------------------
  21. include-tagged::{doc-tests-file}[{api}-request-includeDefaults]
  22. --------------------------------------------------
  23. <1> If true, defaults will be returned for settings not explicitly set on the index
  24. ["source","java",subs="attributes,callouts,macros"]
  25. --------------------------------------------------
  26. include-tagged::{doc-tests-file}[{api}-request-indicesOptions]
  27. --------------------------------------------------
  28. <1> Setting `IndicesOptions` controls how unavailable indices are resolved and
  29. how wildcard expressions are expanded
  30. include::../execution.asciidoc[]
  31. [id="{upid}-{api}-response"]
  32. ==== Get Index Response
  33. The returned +{response}+ allows to retrieve information about the
  34. executed operation as follows:
  35. ["source","java",subs="attributes,callouts,macros"]
  36. --------------------------------------------------
  37. include-tagged::{doc-tests-file}[{api}-response]
  38. --------------------------------------------------
  39. <1> Retrieve a Map of different types to `MappingMetadata` for `index`.
  40. <2> Retrieve a Map for the properties for document type `doc`.
  41. <3> Get the list of aliases for `index`.
  42. <4> Get the value for the setting string `index.number_of_shards` for `index`. If the setting was not explicitly
  43. specified but was part of the default settings (and includeDefault was `true`) then the default setting would be
  44. retrieved.
  45. <5> Retrieve all settings for `index`.
  46. <6> The `Settings` objects gives more flexibility. Here it is used to extract the setting `index.number_of_shards` as an
  47. integer.
  48. <7> Get the default setting `index.refresh_interval` (if `includeDefault` was set to `true`). If `includeDefault` was set
  49. to `false`, `getIndexResponse.defaultSettings()` will return an empty map.