get-snapshot.asciidoc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-snapshot]]
  4. = Get model snapshots API
  5. ++++
  6. <titleabbrev>Get model snapshots</titleabbrev>
  7. ++++
  8. Retrieves information about model snapshots.
  9. [[ml-get-snapshot-request]]
  10. == {api-request-title}
  11. `GET _ml/anomaly_detectors/<job_id>/model_snapshots` +
  12. `GET _ml/anomaly_detectors/<job_id>/model_snapshots/<snapshot_id>`
  13. [[ml-get-snapshot-prereqs]]
  14. == {api-prereq-title}
  15. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_user` built-in role.
  17. [[ml-get-snapshot-path-parms]]
  18. == {api-path-parms-title}
  19. `<job_id>`::
  20. (Required, string)
  21. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  22. `<snapshot_id>`::
  23. (Optional, string)
  24. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=snapshot-id]
  25. +
  26. --
  27. You can multiple snapshots for a single job in a single API request
  28. by using a comma-separated list of `<snapshot_id>` or a wildcard expression.
  29. You can get all snapshots for all calendars by using `_all`,
  30. by specifying `*` as the `<snapshot_id>`, or by omitting the `<snapshot_id>`.
  31. --
  32. [[ml-get-snapshot-request-body]]
  33. == {api-request-body-title}
  34. `desc`::
  35. (Optional, Boolean) If true, the results are sorted in descending order.
  36. `end`::
  37. (Optional, date) Returns snapshots with timestamps earlier than this time.
  38. `from`::
  39. (Optional, integer) Skips the specified number of snapshots.
  40. `size`::
  41. (Optional, integer) Specifies the maximum number of snapshots to obtain.
  42. `sort`::
  43. (Optional, string) Specifies the sort field for the requested snapshots. By
  44. default, the snapshots are sorted by their timestamp.
  45. `start`::
  46. (Optional, string) Returns snapshots with timestamps after this time.
  47. [role="child_attributes"]
  48. [[ml-get-snapshot-results]]
  49. == {api-response-body-title}
  50. The API returns an array of model snapshot objects, which have the following
  51. properties:
  52. `description`::
  53. (string) An optional description of the job.
  54. `job_id`::
  55. (string) A numerical character string that uniquely identifies the job that
  56. the snapshot was created for.
  57. `latest_record_time_stamp`::
  58. (date) The timestamp of the latest processed record.
  59. `latest_result_time_stamp`::
  60. (date) The timestamp of the latest bucket result.
  61. `min_version`::
  62. (string) The minimum version required to be able to restore the model snapshot.
  63. //Begin model_size_stats
  64. `model_size_stats`::
  65. (object) Summary information describing the model.
  66. +
  67. .Properties of `model_size_stats`
  68. [%collapsible%open]
  69. ====
  70. `bucket_allocation_failures_count`:::
  71. (long) The number of buckets for which entities were not processed due to memory
  72. limit constraints.
  73. `categorized_doc_count`:::
  74. (long) The number of documents that have had a field categorized.
  75. `categorization_status`:::
  76. (string) The status of categorization for this job.
  77. Contains one of the following values.
  78. +
  79. --
  80. * `ok`: Categorization is performing acceptably well (or not being
  81. used at all).
  82. * `warn`: Categorization is detecting a distribution of categories
  83. that suggests the input data is inappropriate for categorization.
  84. Problems could be that there is only one category, more than 90% of
  85. categories are rare, the number of categories is greater than 50% of
  86. the number of categorized documents, there are no frequently
  87. matched categories, or more than 50% of categories are dead.
  88. --
  89. `dead_category_count`:::
  90. (long) The number of categories created by categorization that will
  91. never be assigned again because another category's definition
  92. makes it a superset of the dead category. (Dead categories are a
  93. side effect of the way categorization has no prior training.)
  94. `failed_category_count`:::
  95. (long)
  96. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=failed-category-count]
  97. `frequent_category_count`:::
  98. (long) The number of categories that match more than 1% of categorized
  99. documents.
  100. `job_id`:::
  101. (string)
  102. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
  103. `log_time`:::
  104. (date) The timestamp that the `model_size_stats` were recorded, according to
  105. server-time.
  106. `memory_status`:::
  107. (string) The status of the memory in relation to its `model_memory_limit`.
  108. Contains one of the following values.
  109. +
  110. --
  111. * `hard_limit`: The internal models require more space that the configured
  112. memory limit. Some incoming data could not be processed.
  113. * `ok`: The internal models stayed below the configured value.
  114. * `soft_limit`: The internal models require more than 60% of the configured
  115. memory limit and more aggressive pruning will be performed in order to try to
  116. reclaim space.
  117. --
  118. `model_bytes`:::
  119. (long) An approximation of the memory resources required for this analysis.
  120. `model_bytes_exceeded`:::
  121. (long) The number of bytes over the high limit for memory usage at the last allocation failure.
  122. `model_bytes_memory_limit`:::
  123. (long) The upper limit for memory usage, checked on increasing values.
  124. `rare_category_count`:::
  125. (long) The number of categories that match just one categorized document.
  126. `result_type`:::
  127. (string) Internal. This value is always `model_size_stats`.
  128. `timestamp`:::
  129. (date) The timestamp that the `model_size_stats` were recorded, according to the
  130. bucket timestamp of the data.
  131. `total_by_field_count`:::
  132. (long) The number of _by_ field values analyzed. Note that these are counted
  133. separately for each detector and partition.
  134. `total_category_count`:::
  135. (long) The number of categories created by categorization.
  136. `total_over_field_count`:::
  137. (long) The number of _over_ field values analyzed. Note that these are counted
  138. separately for each detector and partition.
  139. `total_partition_field_count`:::
  140. (long) The number of _partition_ field values analyzed.
  141. ====
  142. //End model_size_stats
  143. `retain`::
  144. (Boolean)
  145. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=retain]
  146. `snapshot_id`::
  147. (string) A numerical character string that uniquely identifies the model
  148. snapshot. For example: "1491852978".
  149. `snapshot_doc_count`::
  150. (long) For internal use only.
  151. `timestamp`::
  152. (date) The creation timestamp for the snapshot.
  153. [[ml-get-snapshot-example]]
  154. == {api-examples-title}
  155. [source,console]
  156. --------------------------------------------------
  157. GET _ml/anomaly_detectors/high_sum_total_sales/model_snapshots
  158. {
  159. "start": "1575402236000"
  160. }
  161. --------------------------------------------------
  162. // TEST[skip:Kibana sample data]
  163. In this example, the API provides a single result:
  164. [source,js]
  165. ----
  166. {
  167. "count" : 1,
  168. "model_snapshots" : [
  169. {
  170. "job_id" : "high_sum_total_sales",
  171. "min_version" : "6.4.0",
  172. "timestamp" : 1575402237000,
  173. "description" : "State persisted due to job close at 2019-12-03T19:43:57+0000",
  174. "snapshot_id" : "1575402237",
  175. "snapshot_doc_count" : 1,
  176. "model_size_stats" : {
  177. "job_id" : "high_sum_total_sales",
  178. "result_type" : "model_size_stats",
  179. "model_bytes" : 1638816,
  180. "model_bytes_exceeded" : 0,
  181. "model_bytes_memory_limit" : 10485760,
  182. "total_by_field_count" : 3,
  183. "total_over_field_count" : 3320,
  184. "total_partition_field_count" : 2,
  185. "bucket_allocation_failures_count" : 0,
  186. "memory_status" : "ok",
  187. "categorized_doc_count" : 0,
  188. "total_category_count" : 0,
  189. "frequent_category_count" : 0,
  190. "rare_category_count" : 0,
  191. "dead_category_count" : 0,
  192. "categorization_status" : "ok",
  193. "log_time" : 1575402237000,
  194. "timestamp" : 1576965600000
  195. },
  196. "latest_record_time_stamp" : 1576971072000,
  197. "latest_result_time_stamp" : 1576965600000,
  198. "retain" : false
  199. }
  200. ]
  201. }
  202. ----