[[reference-enrich]]
== client.enrich

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////
++++
<style>
.lang-ts a.xref {
  text-decoration: underline !important;
}
</style>
++++


[discrete]
[[client.enrich.deletePolicy]]
== `client.enrich.deletePolicy()`

Delete an enrich policy. Deletes an existing enrich policy and its enrich index.

{ref}/delete-enrich-policy-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EnrichDeletePolicyRequest, options?: TransportRequestOptions) => Promise<EnrichDeletePolicyResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EnrichDeletePolicyRequest extends <<RequestBase>> {
  name: <<Name>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type EnrichDeletePolicyResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.enrich.executePolicy]]
== `client.enrich.executePolicy()`

Run an enrich policy. Create the enrich index for an existing enrich policy.

{ref}/execute-enrich-policy-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EnrichExecutePolicyRequest, options?: TransportRequestOptions) => Promise<EnrichExecutePolicyResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EnrichExecutePolicyRequest extends <<RequestBase>> {
  name: <<Name>>
  wait_for_completion?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface EnrichExecutePolicyResponse {
  status?: EnrichExecutePolicyExecuteEnrichPolicyStatus
  task_id?: <<TaskId>>
}

----


[discrete]
[[client.enrich.getPolicy]]
== `client.enrich.getPolicy()`

Get an enrich policy. Returns information about an enrich policy.

{ref}/get-enrich-policy-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EnrichGetPolicyRequest, options?: TransportRequestOptions) => Promise<EnrichGetPolicyResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EnrichGetPolicyRequest extends <<RequestBase>> {
  name?: <<Names>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface EnrichGetPolicyResponse {
  policies: <<EnrichSummary>>[]
}

----


[discrete]
[[client.enrich.putPolicy]]
== `client.enrich.putPolicy()`

Create an enrich policy. Creates an enrich policy.

{ref}/put-enrich-policy-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EnrichPutPolicyRequest, options?: TransportRequestOptions) => Promise<EnrichPutPolicyResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EnrichPutPolicyRequest extends <<RequestBase>> {
  name: <<Name>>
  geo_match?: <<EnrichPolicy>>
  match?: <<EnrichPolicy>>
  range?: <<EnrichPolicy>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type EnrichPutPolicyResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.enrich.stats]]
== `client.enrich.stats()`

Get enrich stats. Returns enrich coordinator statistics and information about enrich policies that are currently executing.

{ref}/enrich-stats-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EnrichStatsRequest, options?: TransportRequestOptions) => Promise<EnrichStatsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EnrichStatsRequest extends <<RequestBase>> {}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface EnrichStatsResponse {
  coordinator_stats: EnrichStatsCoordinatorStats[]
  executing_policies: EnrichStatsExecutingPolicy[]
  cache_stats?: EnrichStatsCacheStats[]
}

----


