# Elasticsearch - NEST - Creating mappings for types (.NET)

**URL:** <https://discuss.elastic.co/t/elasticsearch-nest-creating-mappings-for-types-net/277671>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [July 2, 2021, 4:37pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-creating-mappings-for-types-net/277671 "2021-07-02T16:37:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsharma](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@bsharma](https://discuss.elastic.co/u/bsharma)\
**Post date:** [July 2, 2021, 4:37pm UTC](https://discuss.elastic.co/t/elasticsearch-nest-creating-mappings-for-types-net/277671/1 "2021-07-02T16:37:37Z")

</div>

I am using NEST for interacting with Elasticsearch. I am creating mappings for the types dynamically based on `System.Type`, using:

```auto
    settings.DefaultMappingFor(type, d =>
    {
        d.IndexName(indexName);
        d.IdProperty(idPropertyName);
        d.Ignore(prop1Name); // no such method
        return d;
    }

```

I am not able to figure out how to ignore properties in the above snippet. From the [docs](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/ignoring-properties.html) I can see that we can ignore certain properties using the fluent api (with generics).

```auto
    settings.DefaultMappingFor<MyObject>(d =>
    {
        return d.IndexName("my-object")
            .IdProperty(x => x.ID)
            .Ignore(x => x.Prop1)
            .Ignore(x => x.Prop2);
    });

```

But my need is to configure mappings dynamically. Please help, thanks!

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [July 27, 2021, 11:19am UTC](https://discuss.elastic.co/t/elasticsearch-nest-creating-mappings-for-types-net/277671/2 "2021-07-27T11:19:50Z")

</div>

Hi! Unfortunately, the non-generic mappings are more limited in this respect. Are you able to explain more about your situation? Would it be possible to apply the NEST `Ignore` attribute to the properties on the original Type as those should be picked up correctly?

---

<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:** [August 24, 2021, 11:20am UTC](https://discuss.elastic.co/t/elasticsearch-nest-creating-mappings-for-types-net/277671/3 "2021-08-24T11:20:42Z")

</div>

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