get-snapshot.asciidoc 7.4 KB

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