Create enrich policy API

Create enrich policy API

Creates an enrich policy.

  1. PUT /_enrich/policy/my-policy
  2. {
  3. "match": {
  4. "indices": "users",
  5. "match_field": "email",
  6. "enrich_fields": ["first_name", "last_name", "city", "zip", "state"]
  7. }
  8. }

Request

PUT /_enrich/policy/<enrich-policy>

Prerequisites

If you use Elasticsearch security features, you must have:

  • read index privileges for any indices used
  • The enrich_user built-in role

Description

Use the create enrich policy API to create a enrich policy.

Once created, you can’t update or change an enrich policy. Instead, you can:

  1. Create and execute a new enrich policy.
  2. Replace the previous enrich policy with the new enrich policy in any in-use enrich processors.
  3. Use the delete enrich policy API to delete the previous enrich policy.

Path parameters

<enrich-policy>

(Required, string) Name of the enrich policy to create or update.

Request body

<policy-type>

(Required, object) Configures the enrich policy. The field key is the enrich policy type. Valid key values are:

Properties of <policy-type>

  • indices

    (Required, String or array of strings) One or more source indices used to create the enrich index.

    If multiple indices are specified, they must share a common match_field.

    match_field

    (Required, string) Field in source indices used to match incoming documents.

    enrich_fields

    (Required, Array of strings) Fields to add to matching incoming documents. These fields must be present in the source indices.

    query

    (Optional, Query DSL query object) Query used to filter documents in the enrich index. The policy only uses documents matching this query to enrich incoming documents. Defaults to a match_all query.

  • « Enrich APIs

  • Delete enrich policy API »