# Elasticsearch enrich policy not reflecting updated source after \_execute (v9.1.3)

**URL:** <https://discuss.elastic.co/t/elasticsearch-enrich-policy-not-reflecting-updated-source-after-execute-v9-1-3/382141>\
**Category:** Elasticsearch\
**Tags:** painless, ingest-pipeline\
**Created:** [September 22, 2025, 11:24pm UTC](https://discuss.elastic.co/t/elasticsearch-enrich-policy-not-reflecting-updated-source-after-execute-v9-1-3/382141 "2025-09-22T23:24:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Santos1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_santos1/32/145135_2.png) [@Daniel\_Santos1](https://discuss.elastic.co/u/Daniel_Santos1)\
**Post date:** [September 22, 2025, 11:25pm UTC](https://discuss.elastic.co/t/elasticsearch-enrich-policy-not-reflecting-updated-source-after-execute-v9-1-3/382141/1 "2025-09-22T23:25:00Z")

</div>

Hi, I’m running into an issue with enrich policies in Elasticsearch **v9.1.3**.

When I update the source index used by an enrich policy and then re-execute the policy, the enrich simulation still returns stale data. The updated fields are not visible right away.

Workarounds I found:

- If I delete and recreate the policy, the updated values appear.
- If I wait a while, the updates eventually show up.
- If I delete and recreate the pipeline, it also works.

But ideally, the policy re-execution should pick up the changes immediately.

* * *

### Repro Steps

**1. Create the enrich index and seed some docs**

```json
PUT enrich_u_v1
{
  "mappings": {
    "properties": {
      "unit_ref": { "type": "keyword" },
      "id": { "type": "keyword" },
      "name": { "type": "keyword" },
      "ext_id": { "type": "keyword" }
    }
  }
}

PUT enrich_u_v1/_doc/1?refresh=true
{"unit_ref":"U001","id":"1","name":"Unit One","ext_id":"A-1"}

PUT enrich_u_v1/_doc/2?refresh=true
{"unit_ref":"U002","id":"2","name":"Unit Two","ext_id":"A-2"}

```

**2. Create the enrich policy and execute it**

```json
PUT _enrich/policy/u_policy
{
  "match": {
    "indices": "enrich_u_*",
    "match_field": "unit_ref",
    "enrich_fields": ["id", "name", "ext_id"]
  }
}

POST _enrich/policy/u_policy/_execute?wait_for_completion=true

```

**3. Create a pipeline using the policy**

```json
PUT _ingest/pipeline/enrich_u_pipeline
{
  "processors": [
    {
      "enrich": {
        "override": true,
        "max_matches": 1,
        "policy_name": "u_policy",
        "field": "unit_ref",
        "target_field": "unit",
        "ignore_missing": true
      }
    }
  ]
}

```

**4. Simulate with initial data**

```json
POST _ingest/pipeline/enrich_u_pipeline/_simulate
{
  "docs": [
    { "_source": { "unit_ref": "U001" } }
  ]
}

```

→ Works fine, enrich returns `"Unit One"`.

**5. Update the source index**

```json
POST enrich_u_v1/_update_by_query?refresh=true
{
  "script": {
    "source": "ctx._source.name = 'Unit One (UPDATED)'",
    "lang": "painless"
  },
  "query": { "term": { "unit_ref": "U001" } }
}

```

**6. Re-execute the policy and simulate again**

```json
POST _enrich/policy/u_policy/_execute?wait_for_completion=true

POST _ingest/pipeline/enrich_u_pipeline/_simulate?verbose=true
{
  "docs": [
    { "_source": { "unit_ref": "U001" } }
  ]
}

```

→ Still shows `"Unit One"` instead of `"Unit One (UPDATED)"`.

* * *

### Expected Behavior

After updating the enrich index and re-executing the policy, I expect simulations to return the updated field values immediately.

### Actual Behavior

Values stay stale until I:

- wait some time, or
- delete/recreate the policy or pipeline.

* * *

### Question

Is this expected behavior (due to some caching/async refresh), or is there a missing step to force refresh the enrich index for the policy?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [September 22, 2025, 11:56pm UTC](https://discuss.elastic.co/t/elasticsearch-enrich-policy-not-reflecting-updated-source-after-execute-v9-1-3/382141/2 "2025-09-22T23:56:50Z")

</div>

> [@Daniel\_Santos1](#):
>
> But ideally, the policy re-execution should pick up the changes immediately.

If I'm not wrong, this is not how it works, it may take some for an enrich policy execute to finish.

First It needs to create a new index with the documents from the source index, depending on the size of the source index and specs of the cluster this may take some time, after that it needs to force merge the index, which can also take some time, it is not something that runs immediatelly.

So, you need to wait some time for the data to be updated after an execute request.

---

<div class="post-metadata">

**Author:** ![Daniel\_Santos1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/daniel_santos1/32/145135_2.png) [@Daniel\_Santos1](https://discuss.elastic.co/u/Daniel_Santos1)\
**Post date:** [September 23, 2025, 12:01am UTC](https://discuss.elastic.co/t/elasticsearch-enrich-policy-not-reflecting-updated-source-after-execute-v9-1-3/382141/3 "2025-09-23T00:01:25Z")

</div>

Just figured out that from 9.1.0–9.1.3 there’s an issue where the **enrich processor keeps using a cached view of the enrich index even after you re-execute the policy** ,

so simulations (and ingest) can return stale values. Elastic fixed this in **9.1.4**

- Fix enrich caches outdated value after policy run [#133680](https://github.com/elastic/elasticsearch/pull/133680)

Upgrading to **9.1.4+** resolves it.

> **[Elasticsearch release notes | Reference](https://www.elastic.co/docs/release-notes/elasticsearch#elasticsearch-9.0.7-release-notes)**
>
> Review the changes, fixes, and more in each version of Elasticsearch. To check for security updates, go to Security announcements for the Elastic stack...
