estimate-model-memory.asciidoc 2.7 KB

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