get-snapshot.asciidoc 8.1 KB

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