put-global-retention.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. [[data-streams-put-global-retention]]
  2. === Update the global retention of data streams
  3. ++++
  4. <titleabbrev>Update Data Stream Global Retention</titleabbrev>
  5. ++++
  6. preview::[]
  7. Updates the global retention configuration that applies on every data stream managed by <<data-stream-lifecycle,data stream lifecycle>>.
  8. [[put-global-retention-api-prereqs]]
  9. ==== {api-prereq-title}
  10. ** If the {es} {security-features} are enabled, you must have the `manage_data_stream_global_retention` <<privileges-list-cluster,cluster privilege>> to use this API.
  11. [[data-streams-put-global-retention-request]]
  12. ==== {api-request-title}
  13. `PUT _data_stream/_global_retention`
  14. [[data-streams-put-global-retention-desc]]
  15. ==== {api-description-title}
  16. Updates the global retention configuration that is applied on data streams managed by data stream lifecycle.
  17. [role="child_attributes"]
  18. [[put-global-retention-api-query-parms]]
  19. ==== {api-query-parms-title}
  20. `dry_run`::
  21. (Boolean) Signals that the request should determine the effect of the provided configuration without updating the
  22. global retention settings. The default value is `false`, which means the configuration provided will be applied.
  23. [[put-global-retention-api-request-body]]
  24. ==== {api-request-body-title}
  25. `default_retention`::
  26. (Optional, string)
  27. The default retention that will apply to any data stream managed by data stream lifecycle that does not have a retention
  28. defined on the data stream level.
  29. `max_retention`::
  30. (Optional, string)
  31. The max retention that will apply to all data streams managed by data stream lifecycle. The max retention will override the
  32. retention of a data stream which retention exceeds the max retention.
  33. [[put-global-retention-api-response-body]]
  34. ==== {api-response-body-title}
  35. `acknowledged`::
  36. (boolean)
  37. True, if the global retention has been updated to the provided values. False, if it fails or if it was a dry run.
  38. `dry_run`::
  39. (boolean)
  40. True, if this was a dry run, false otherwise.
  41. `affected_data_streams`::
  42. (array of objects)
  43. Contains information about the data streams affected by the change.
  44. +
  45. .Properties of objects in `affected_data_streams`
  46. [%collapsible%open]
  47. ====
  48. `name`::
  49. (string)
  50. Name of the data stream.
  51. `previous_effective_retention`::
  52. (string)
  53. The retention that was effective before the change of this request. `infinite` if there was no retention applicable.
  54. `new_effective_retention`::
  55. (string)
  56. The retention that is or would be effective after this request. `infinite` if there is no retention applicable.
  57. ====
  58. [[data-streams-put-global-retention-example]]
  59. ==== {api-examples-title}
  60. ////
  61. [source,console]
  62. ----
  63. PUT /_index_template/template
  64. {
  65. "index_patterns": ["my-data-stream*"],
  66. "template": {
  67. "lifecycle": {}
  68. },
  69. "data_stream": { }
  70. }
  71. PUT /_data_stream/my-data-stream
  72. ----
  73. // TESTSETUP
  74. ////
  75. ////
  76. [source,console]
  77. ----
  78. DELETE /_data_stream/my-data-stream*
  79. DELETE /_index_template/template
  80. DELETE /_data_stream/_global_retention
  81. ----
  82. // TEARDOWN
  83. ////
  84. Let's update the global retention:
  85. [source,console]
  86. --------------------------------------------------
  87. PUT _data_stream/_global_retention
  88. {
  89. "default_retention": "7d",
  90. "max_retention": "90d"
  91. }
  92. --------------------------------------------------
  93. The response will look like the following:
  94. [source,console-result]
  95. --------------------------------------------------
  96. {
  97. "acknowledged": true,
  98. "dry_run": false,
  99. "affected_data_streams": [
  100. {
  101. "name": "my-data-stream",
  102. "previous_effective_retention": "infinite",
  103. "new_effective_retention": "7d"
  104. }
  105. ]
  106. }
  107. --------------------------------------------------