get-snapshot.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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-path-parms]]
  14. ==== {api-path-parms-title}
  15. `job_id`::
  16. (string) Identifier for the job.
  17. `snapshot_id`::
  18. (string) Identifier for the model snapshot. If you do not specify this
  19. optional parameter, the API returns information about all model snapshots.
  20. [[ml-get-snapshot-request-body]]
  21. ==== {api-request-body-title}
  22. `desc`::
  23. (boolean) If true, the results are sorted in descending order.
  24. `end`::
  25. (date) Returns snapshots with timestamps earlier than this time.
  26. `from`::
  27. (integer) Skips the specified number of snapshots.
  28. `size`::
  29. (integer) Specifies the maximum number of snapshots to obtain.
  30. `sort`::
  31. (string) Specifies the sort field for the requested snapshots.
  32. By default, the snapshots are sorted by their timestamp.
  33. `start`::
  34. (string) Returns snapshots with timestamps after this time.
  35. [[ml-get-snapshot-results]]
  36. ==== {api-response-body-title}
  37. The API returns the following information:
  38. `model_snapshots`::
  39. (array) An array of model snapshot objects. For more information, see
  40. <<ml-snapshot-resource,Model Snapshots>>.
  41. [[ml-get-snapshot-prereqs]]
  42. ==== {api-prereq-title}
  43. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  44. privileges to use this API. For more information, see
  45. {stack-ov}/security-privileges.html[Security privileges].
  46. [[ml-get-snapshot-example]]
  47. ==== {api-examples-title}
  48. The following example gets model snapshot information for the
  49. `it_ops_new_logs` job:
  50. [source,js]
  51. --------------------------------------------------
  52. GET _ml/anomaly_detectors/farequote/model_snapshots
  53. {
  54. "start": "1491852977000"
  55. }
  56. --------------------------------------------------
  57. // CONSOLE
  58. // TEST[skip:todo]
  59. In this example, the API provides a single result:
  60. [source,js]
  61. ----
  62. {
  63. "count": 1,
  64. "model_snapshots": [
  65. {
  66. "job_id": "farequote",
  67. "min_version": "6.3.0",
  68. "timestamp": 1491948163000,
  69. "description": "State persisted due to job close at 2017-04-11T15:02:43-0700",
  70. "snapshot_id": "1491948163",
  71. "snapshot_doc_count": 1,
  72. "model_size_stats": {
  73. "job_id": "farequote",
  74. "result_type": "model_size_stats",
  75. "model_bytes": 387594,
  76. "total_by_field_count": 21,
  77. "total_over_field_count": 0,
  78. "total_partition_field_count": 20,
  79. "bucket_allocation_failures_count": 0,
  80. "memory_status": "ok",
  81. "log_time": 1491948163000,
  82. "timestamp": 1455234600000
  83. },
  84. "latest_record_time_stamp": 1455235196000,
  85. "latest_result_time_stamp": 1455234900000,
  86. "retain": false
  87. }
  88. ]
  89. }
  90. ----