estimate-model-memory.asciidoc 2.7 KB

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