get-snapshot.asciidoc 2.7 KB

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