estimate-model-memory.asciidoc 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 is based
  9. 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. Requires the `manage_ml` cluster privilege. This privilege is included in the
  17. `machine_learning_admin` built-in role.
  18. [[ml-estimate-model-memory-request-body]]
  19. == {api-request-body-title}
  20. `analysis_config`::
  21. (Required, object)
  22. For a list of the properties that you can specify in the `analysis_config`
  23. component of the body of this API, see <<put-analysisconfig,`analysis_config`>>.
  24. `max_bucket_cardinality`::
  25. (Required^\*^, object)
  26. Estimates of the highest cardinality in a single bucket that is observed for
  27. influencer fields over the time period that the job analyzes data. To produce a
  28. good answer, values must be provided for all influencer fields. Providing values
  29. for fields that are not listed as `influencers` has no effect on the estimation. +
  30. ^*^It can be omitted from the request if there are no `influencers`.
  31. `overall_cardinality`::
  32. (Required^\*^, object)
  33. Estimates of the cardinality that is observed for fields over the whole time
  34. period that the job analyzes data. To produce a good answer, values must be
  35. provided for fields referenced in the `by_field_name`, `over_field_name` and
  36. `partition_field_name` of any detectors. Providing values for other fields has
  37. no effect on the estimation. +
  38. ^*^It can be omitted from the request if no detectors have a `by_field_name`,
  39. `over_field_name` or `partition_field_name`.
  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. ----