get-snapshot.asciidoc 2.7 KB

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