get-snapshot.asciidoc 7.3 KB

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