estimate-model-memory.asciidoc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [role="xpack"]
  2. [[ml-estimate-model-memory]]
  3. = Estimate {anomaly-jobs} model memory API
  4. ++++
  5. <titleabbrev>Estimate model memory</titleabbrev>
  6. ++++
  7. Makes an estimation of the memory usage for an {anomaly-job} model. It is based
  8. on analysis configuration details for the job and cardinality estimates for the
  9. fields it references.
  10. [[ml-estimate-model-memory-request]]
  11. == {api-request-title}
  12. `POST _ml/anomaly_detectors/_estimate_model_memory`
  13. [[ml-estimate-model-memory-prereqs]]
  14. == {api-prereq-title}
  15. Requires the `manage_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_admin` built-in role.
  17. [[ml-estimate-model-memory-request-body]]
  18. == {api-request-body-title}
  19. `analysis_config`::
  20. (Required, object)
  21. For a list of the properties that you can specify in the `analysis_config`
  22. component of the body of this API, see <<put-analysisconfig,`analysis_config`>>.
  23. `max_bucket_cardinality`::
  24. (Required^\*^, object)
  25. Estimates of the highest cardinality in a single bucket that is observed for
  26. influencer fields over the time period that the job analyzes data. To produce a
  27. good answer, values must be provided for all influencer fields. Providing values
  28. for fields that are not listed as `influencers` has no effect on the estimation. +
  29. ^*^It can be omitted from the request if there are no `influencers`.
  30. `overall_cardinality`::
  31. (Required^\*^, object)
  32. Estimates of the cardinality that is observed for fields over the whole time
  33. period that the job analyzes data. To produce a good answer, values must be
  34. provided for fields referenced in the `by_field_name`, `over_field_name` and
  35. `partition_field_name` of any detectors. Providing values for other fields has
  36. no effect on the estimation. +
  37. ^*^It can be omitted from the request if no detectors have a `by_field_name`,
  38. `over_field_name` or `partition_field_name`.
  39. [[ml-estimate-model-memory-example]]
  40. == {api-examples-title}
  41. [source,console]
  42. --------------------------------------------------
  43. POST _ml/anomaly_detectors/_estimate_model_memory
  44. {
  45. "analysis_config": {
  46. "bucket_span": "5m",
  47. "detectors": [
  48. {
  49. "function": "sum",
  50. "field_name": "bytes",
  51. "by_field_name": "status",
  52. "partition_field_name": "app"
  53. }
  54. ],
  55. "influencers": [ "source_ip", "dest_ip" ]
  56. },
  57. "overall_cardinality": {
  58. "status": 10,
  59. "app": 50
  60. },
  61. "max_bucket_cardinality": {
  62. "source_ip": 300,
  63. "dest_ip": 30
  64. }
  65. }
  66. --------------------------------------------------
  67. // TEST[skip:needs-licence]
  68. The estimate returns the following result:
  69. [source,console-result]
  70. ----
  71. {
  72. "model_memory_estimate": "21mb"
  73. }
  74. ----