get-snapshot.asciidoc 7.8 KB

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