Disable adding match_field when enriching data in ingest pipeline?

I'm trying to use reindex with help of ingest pipeline to enrich my data. I have problem with enrich processor.
I have created this policy

PUT /_enrich/policy/ingest-policy
{
  "match": {
    "indices": "ingest_two",
    "match_field": "matchingId",
    "enrich_fields": ["textValue"]
  }
}

Which is used in this processor:

    {
      "enrich": {
        "field": "_id",
        "policy_name": "ingest-policy",
        "target_field": "systemMetadata.com:vjoon:System:searchContentHTML",
        "override": true
      }
    }

As you can see I'm comparing _id with matchingId field. It works fine, but matchingId is added to the systemMetadata.com:vjoon:System:searchContentHTML, which I do not want to do. Can I change this behaviour, co only textValue is added and not the matchingId?

I don't think this is possible, the match_field is always added.

In the documentation there is this description for the target_field.

Field added to incoming documents to contain enrich data. This field contains both the match_field and enrich_fields specified in the enrich policy.

Which seems to indicate that the match_field will always be added.

When I used the enrich processor a while ago, I had a remove processor after it to remove the match_field from the enriched documents, I think you will need something in this way.

2 Likes