# Update doc in index

**URL:** <https://discuss.elastic.co/t/update-doc-in-index/379090>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 11, 2025, 9:26am UTC](https://discuss.elastic.co/t/update-doc-in-index/379090 "2025-06-11T09:26:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tazieviikz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tazieviikz/32/143627_2.png) [@tazieviikz](https://discuss.elastic.co/u/tazieviikz)\
**Post date:** [June 11, 2025, 9:26am UTC](https://discuss.elastic.co/t/update-doc-in-index/379090/1 "2025-06-11T09:26:20Z")

</div>

I need help with update docs in index. Filebeat upload CSV files from disk to index

FB config

```auto
- type: log
  id: persons
  enabled: true
  paths:
    - /data1/Logs/Preprod/Persons/*.csv
  fields:
    log_type: persons
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
  username: "***"
  password: "***"
  indices:
    - index: "orders-from-csv"
      when.equals:
        fields.log_type: "orders-from-csv"
    - index: "persons"
      when.equals:
        fields.log_type: "persons"
  pipeline: "%{[fields.log_type]}-pipeline" 
  action: "index"

```

Here settings of pipeline

```auto
PUT _ingest/pipeline/persons-pipeline
{
  "description": "Ingest pipeline created by text structure finder",
  "processors": [
    {
      "csv": {
        "field": "message",
        "target_fields": [
          "[Name]",
          "[IIS]",
          "[BirthDay]",
          "column4",
          "[OisKey]",
          "[Qual]",
          "[Address]",
          "[Email]",
          "[Id]"
        ],
        "separator": ";",
        "ignore_missing": false
      }
    },
    {
      "set": {
        "field": "debug_original_message",
        "value": "{{message}}"
      }
    },
    {
      "convert": {
        "field": "[Id]",
        "type": "long"
      }
    },
    {
      "date": {
        "field": "column4",
        "formats": [
          "yyyy-MM-dd HH:mm:ss.SSS"
        ],
        "target_field": "[RegDate]",
        "timezone": "Europe/Moscow"
      }
    },
    {
      "date": {
        "field": "column4",
        "formats": [
          "yyyy-MM-dd HH:mm:ss.SSS"
        ],
        "target_field": "[RegDateDay]",
        "output_format": "dd-MM-yyyy"
      }
    },
    {
      "remove": {
        "field": "message"
      }
    },
    {
      "set": {
        "field": "_id",
        "value": "{{[OisKey]}}"
      }
    }
  ],
  "on_failure": [
    {
      "set": {
        "field": "error.message",
        "value": "{{ _ingest.on_failure_message }}"
      }
    }
  ]
}

```

How do I update an existing document? Now when a document arrives with an id and diff some field that is already exist in the index, it is ignored.

UPDATE: I can update the document via API, but I need to update it automatically by checking for changes or by overwriting it
