# Elasticsearch.NET Disable ID inference

**URL:** <https://discuss.elastic.co/t/elasticsearch-net-disable-id-inference/133228>\
**Category:** Elasticsearch\
**Created:** [May 24, 2018, 10:57pm UTC](https://discuss.elastic.co/t/elasticsearch-net-disable-id-inference/133228 "2018-05-24T22:57:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremysmith1](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jeremysmith1](https://discuss.elastic.co/u/jeremysmith1)\
**Post date:** [May 24, 2018, 10:57pm UTC](https://discuss.elastic.co/t/elasticsearch-net-disable-id-inference/133228/1 "2018-05-24T22:57:39Z")

</div>

I have a collection of c# POCOs that I cannot modify. Some of them have a field called "id" that gets picked up as the \_id in the mapping. These obj have duplicate id, which causes the last inserted obj to upsert over the others.

Is there a way for me to set the client to ignore inference of the id by using reflection to find the name "id"?

---

<div class="post-metadata">

**Author:** ![Martijn\_Laarman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/martijn_laarman/32/4410_2.png) [@Martijn\_Laarman](https://discuss.elastic.co/u/Martijn_Laarman)\
**Post date:** [June 1, 2018, 12:58pm UTC](https://discuss.elastic.co/t/elasticsearch-net-disable-id-inference/133228/2 "2018-06-01T12:58:26Z")

</div>

You can influence the inference in code without touching the class itself as well

```auto
 .DefaultMappingFor<MyDTO>(m => m
        .IdProperty(p => p.OtherName)
    )

```

See more examples here: [https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/ids-inference.html](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/ids-inference.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 29, 2018, 12:58pm UTC](https://discuss.elastic.co/t/elasticsearch-net-disable-id-inference/133228/3 "2018-06-29T12:58:32Z")

</div>

Closed on June 29, 2018, 12:58pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
