---
type: api
title: Get an enrich policy
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v9/operation/operation-enrich-get-policy
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v9/operation/operation-enrich-get-policy
products:
  - Elasticsearch
---

# Get an enrich policy

Authentication: required

Availability: Generally available since 7.5

## Paths

- `GET` `/_enrich/policy/{name}`
- `GET` `/_enrich/policy`

#### Path parameters

- `name` (union string | string[]) — optional, leave it out to use `/_enrich/policy`
  Comma-separated list of enrich policy names used to limit the request.
To return information for all enrich policies, omit this parameter.

## Description

Returns information about an enrich policy.

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  Period to wait for a connection to the master node.

## Response

`application/json`

- `policies` (object[])
  - `config` (map string to object · min properties: 1 · max properties: 1)
    Map values (object)
    - `enrich_fields` (union oneOf)
      One of: `string[]` or `string`
    - `indices` (union oneOf)
      One of: `string[]` or `string`
    - `match_field` (string)
    - `query` ({} Query)
      See [Query](https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/elasticsearch/v9/types/_types-query_dsl-querycontainer)
    - `name` (string)
    - `elasticsearch_version` (string)
## Code examples

#### Console

```console
GET /_enrich/policy/my-policy
```

#### JavaScript

```javascript
const response = await client.enrich.getPolicy({
  name: "my-policy",
});
```

#### Python

```python
resp = client.enrich.get_policy(
    name="my-policy",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_enrich/policy/my-policy" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.enrich().getPolicy(g -> g
    .name("my-policy")
);
```

#### C#

```c#
var response = await client.Enrich
    .GetPolicyAsync(d1 => d1
        .Name(new[] { "my-policy" })
    );
```

#### PHP

```php
$resp = $client->enrich()->getPolicy([
    "name" => "my-policy",
]);
```

#### Ruby

```ruby
response = client.enrich.get_policy(
  name: "my-policy"
)
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "policies": [
    {
      "config": {
        "key": {
          "match_field": "string",
          "query": {},
          "name": "string",
          "elasticsearch_version": "string"
        }
      }
    }
  ]
}
```

