--
:api: estimate-model-memory
:request: EstimateModelMemoryRequest
:response: EstimateModelMemoryResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Estimate {anomaly-job} model memory API

Estimate the model memory an analysis config is likely to need for
the given cardinality of the fields it references.

[id="{upid}-{api}-request"]
==== Estimate {anomaly-job} model memory request

A +{request}+ can be set up as follows:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------
<1> Pass an `AnalysisConfig` to the constructor.
<2> For any `by_field_name`, `over_field_name` or
    `partition_field_name` fields referenced by the
    detectors, supply overall cardinality estimates
    in a `Map`.
<3> For any `influencers`, supply a `Map` containing
    estimates of the highest cardinality expected in
    any single bucket.

include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Estimate {anomaly-job} model memory response

The returned +{response}+ contains the model memory estimate:

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The model memory estimate.
