原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/get-enrich-policy-api.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/get-enrich-policy-api.html

Get enrich policy APIedit

Returns information about an enrich policy.

GET /_enrich/policy/my-policy

Requestedit

GET /_enrich/policy/<name>

GET /_enrich/policy

GET /_enrich/policy/policy1,policy2

Prerequisitesedit

If you use Elasticsearch security features, you must have:

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

Path parametersedit

<name>

(Optional, string) Comma-separated list of enrich policy names used to limit the request.

To return information for all enrich policies, omit this parameter.

Examplesedit

Get a single policyedit

GET /_enrich/policy/my-policy

The API returns the following response:

{
    "policies": [
        {
            "config": {
                "match": {
                    "name" : "my-policy",
                    "indices" : ["users"],
                    "match_field" : "email",
                    "enrich_fields" : [
                        "first_name",
                        "last_name",
                        "city",
                        "zip",
                        "state"
                    ]
                }
            }
        }
    ]
}

Get multiple policiesedit

GET /_enrich/policy/my-policy,other-policy

The API returns the following response:

{
    "policies": [
        {
            "config": {
                "match": {
                    "name" : "my-policy",
                    "indices" : ["users"],
                    "match_field" : "email",
                    "enrich_fields" : [
                        "first_name",
                        "last_name",
                        "city",
                        "zip",
                        "state"
                    ]
                }
            }
        },
        {
            "config": {
                "match": {
                    "name" : "other-policy",
                    "indices" : ["users"],
                    "match_field" : "email",
                    "enrich_fields" : [
                        "first_name",
                        "last_name",
                        "city",
                        "zip",
                        "state"
                    ]
                }
            }
        }
    ]
}

Get all policiesedit

GET /_enrich/policy

The API returns the following response:

{
    "policies": [
        {
            "config": {
                "match": {
                    "name" : "my-policy",
                    "indices" : ["users"],
                    "match_field" : "email",
                    "enrich_fields" : [
                        "first_name",
                        "last_name",
                        "city",
                        "zip",
                        "state"
                    ]
                }
            }
        },
        {
            "config": {
                "match": {
                    "name" : "other-policy",
                    "indices" : ["users"],
                    "match_field" : "email",
                    "enrich_fields" : [
                        "first_name",
                        "last_name",
                        "city",
                        "zip",
                        "state"
                    ]
                }
            }
        }
    ]
}