# Mapping document indexing with NEST

**URL:** <https://discuss.elastic.co/t/mapping-document-indexing-with-nest/261156>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 14, 2021, 5:06pm UTC](https://discuss.elastic.co/t/mapping-document-indexing-with-nest/261156 "2021-01-14T17:06:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Izzy](https://avatars.discourse-cdn.com/v4/letter/i/c2a13f/32.png) [@Izzy](https://discuss.elastic.co/u/Izzy)\
**Post date:** [January 14, 2021, 5:06pm UTC](https://discuss.elastic.co/t/mapping-document-indexing-with-nest/261156/1 "2021-01-14T17:06:45Z")

</div>

I'm using .NET Core application with NEST client.  
My goal is to index a model with few modifications in its properties, for example, this model contains list of objects, and I would like to document list of the Ids of the objects instead of the objects themselves.

So, I have made a test, I created a mapping, according to the information I have found over here:

```auto
var result = elasticClient.Indices.Create("change-log", c => c
    .Map<ChangeLog>(m => m
        .Properties(ps => ps
            .Text(s => s
                .Name(n => n.Source)
            )
            .Text(s => s
                .Name("test")
                )
        )
    )
);

```

After this code runs, I can see in **Index Management - Mapping** that my mapping was just created for 'change-log' index.

Right after the execution of the previous code I'm trying to index my model with the following code:

```auto
var indexResponse1 = elasticClient.Index(data, i => i.Index("change-log"));

```

The model inside data variable indexed regardless the mapping that was just created, and when I am looking again in **Index Management - Mapping** I can see that mapping was changed to the structure of the model held inside data variable.

What is wrong with my code? would be grateful for your help.

---

<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:** [February 11, 2021, 5:06pm UTC](https://discuss.elastic.co/t/mapping-document-indexing-with-nest/261156/2 "2021-02-11T17:06:49Z")

</div>

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