# Custom document IDs via Logstash output plugin

**URL:** <https://forum.opensearch.org/t/custom-document-ids-via-logstash-output-plugin/12482>\
**Category:** OpenSearch\
**Created:** [February 13, 2023, 10:37am UTC](https://forum.opensearch.org/t/custom-document-ids-via-logstash-output-plugin/12482 "2023-02-13T10:37:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulrichsg](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/ulrichsg/32/4859_2.png) [@ulrichsg](https://forum.opensearch.org/u/ulrichsg)\
**Post date:** [February 13, 2023, 10:37am UTC](https://forum.opensearch.org/t/custom-document-ids-via-logstash-output-plugin/12482/1 "2023-02-13T10:37:55Z")

</div>

Hello. My team is using Elasticsearch on AWS to provide search functionality over our customer database. The index is continuously updated by a Logstash instance using the [logstash-output-amazon\_es](https://github.com/awslabs/logstash-output-amazon_es) plugin. To ensure that changes in existing customers cause document updates rather than the creation of new documents, we set a custom document ID like so (`id` is one of the columns being read by the JDBC input plugin):

```auto
filter {
    mutate {
        add_field => { "[@metadata][_id]" => "%{id}" }
    }
}

output {
    amazon_es {
        ...
        document_id => "%{[@metadata][_id]}"
    }
}

```

Now we would like to update to OpenSearch and use the [logstash-output-opensearch](https://github.com/opensearch-project/logstash-output-opensearch) plugin, but apparently that plugin does not support setting a custom `document_id`. Is there another way we can ensure a 1:1 relationship between customers in the database and in the index?

Thanks in advance!
