estimate-model-memory.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. (Optional, 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`. If there are no `influencers` then
  29. `max_bucket_cardinality` can be omitted from the request.
  30. `overall_cardinality`::
  31. (Optional, object) Estimates of the cardinality that will be observed for
  32. fields over the whole time period that the job analyzes data. To produce
  33. a good answer, values must be provided for fields referenced in the
  34. `by_field_name`, `over_field_name` and `partition_field_name` of any
  35. detectors. It does not matter if values are provided for other fields.
  36. If no detectors have a `by_field_name`, `over_field_name` or
  37. `partition_field_name` then `overall_cardinality` can be omitted
  38. from the request.
  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": "45mb"
  73. }
  74. ----