explain-data-lifecycle.asciidoc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. [[dlm-explain-lifecycle]]
  2. === Explain Lifecycle API
  3. ++++
  4. <titleabbrev>Explain Data Lifecycle</titleabbrev>
  5. ++++
  6. experimental::[]
  7. Retrieves the current data lifecycle status for one or more data stream backing indices.
  8. [[dlm-explain-lifecycle-request]]
  9. ==== {api-request-title}
  10. `GET <target>/_lifecycle/explain`
  11. [[dlm-explain-lifecycle-desc]]
  12. ==== {api-description-title}
  13. Retrieves information about the index's current DLM lifecycle state, such as
  14. time since index creation, time since rollover, the lifecycle configuration
  15. managing the index, or any error that {es} might've encountered during the lifecycle
  16. execution.
  17. [[dlm-explain-lifecycle-path-params]]
  18. ==== {api-path-parms-title}
  19. `<target>`::
  20. (Required, string) Comma-separated list of indices.
  21. [[dlm-explain-lifecycle-query-params]]
  22. ==== {api-query-parms-title}
  23. `include_defaults`::
  24. (Optional, Boolean) Includes default configurations related to the lifecycle of the target index.
  25. Defaults to `false`.
  26. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  27. [[dlm-explain-lifecycle-example]]
  28. ==== {api-examples-title}
  29. The following example retrieves the lifecycle state of the index `.ds-metrics-2023.03.22-000001`:
  30. [source,console]
  31. --------------------------------------------------
  32. GET .ds-metrics-2023.03.22-000001/_lifecycle/explain
  33. --------------------------------------------------
  34. // TEST[skip:we're not setting up DLM in these tests]
  35. If the index is managed by DLM `explain` will show the `managed_by_dlm` field
  36. set to `true` and the rest of the response will contain information about the
  37. lifecycle execution status for this index:
  38. [source,console-result]
  39. --------------------------------------------------
  40. {
  41. "indices": {
  42. ".ds-metrics-2023.03.22-000001": {
  43. "index" : ".ds-metrics-2023.03.22-000001",
  44. "managed_by_dlm" : true, <1>
  45. "index_creation_date_millis" : 1679475563571, <2>
  46. "time_since_index_creation" : "843ms", <3>
  47. "rollover_date_millis" : 1679475564293, <4>
  48. "time_since_rollover" : "121ms", <5>
  49. "lifecycle" : { }, <6>
  50. "generation_time" : "121ms" <7>
  51. }
  52. }
  53. --------------------------------------------------
  54. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  55. <1> Shows if the index is being managed by DLM. If the index is not managed by
  56. DLM the other fields will not be shown
  57. <2> When the index was created, this timestamp is used to determine when to
  58. rollover
  59. <3> The time since the index creation (used for calculating when to rollover
  60. the index via the `max_age`)
  61. <4> When the index was rolled over. If the index was not rolled over this will not be
  62. shown.
  63. <5> The time since rollover. If the index was not rolled over this will not be shown.
  64. <6> The lifecycle configuration that applies to this index (which is configured on the parent
  65. data stream)
  66. <7> The generation time of the index represents the time since the index started progressing
  67. towards the user configurable / business specific parts of the lifecycle (e.g. retention).
  68. Every index will have to wait for it to be rolled over before being able to progress to the
  69. business-specific part of the lifecycle (i.e. the index advances in its lifecycle after it
  70. stops being the write index of a data stream). If the index has not been rolled over the
  71. `generation_time` will not be reported.
  72. The `explain` will also report any errors related to the lifecycle execution for the target
  73. index:
  74. [source,console-result]
  75. --------------------------------------------------
  76. {
  77. "indices": {
  78. ".ds-metrics-2023.03.22-000001": {
  79. "index" : ".ds-metrics-2023.03.22-000001",
  80. "managed_by_dlm" : true,
  81. "index_creation_date_millis" : 1679475563571,
  82. "time_since_index_creation" : "843ms",
  83. "lifecycle" : { },
  84. "error": "{\"type\":\"validation_exception\",\"reason\":\"Validation Failed: 1: this action would add [2] shards, but this cluster
  85. currently has [4]/[3] maximum normal shards open;\"}" <1>
  86. }
  87. }
  88. --------------------------------------------------
  89. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  90. <1> The target index could not be rolled over due to a limitation in the number of shards
  91. allowed in the cluster.