get-snapshot.asciidoc 2.9 KB

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