# How to Map dynamic columns of a class in Elastic

**URL:** <https://discuss.elastic.co/t/how-to-map-dynamic-columns-of-a-class-in-elastic/281042>\
**Category:** Elasticsearch\
**Created:** [August 11, 2021, 11:02am UTC](https://discuss.elastic.co/t/how-to-map-dynamic-columns-of-a-class-in-elastic/281042 "2021-08-11T11:02:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SUSANTA\_PRADHAN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/susanta_pradhan/32/80406_2.png) [@SUSANTA\_PRADHAN](https://discuss.elastic.co/u/SUSANTA_PRADHAN)\
**Post date:** [August 11, 2021, 11:02am UTC](https://discuss.elastic.co/t/how-to-map-dynamic-columns-of-a-class-in-elastic/281042/1 "2021-08-11T11:02:11Z")

</div>

I have a class say Employee having two columns like Key and Value. I get response from one api response like (the response has key value pairs like key1: value1 and the response is dynamic in nature) {

"notes":[

"title":"xyz", "description":"abc", ----------And its going on dynamic in nature

]

}

So I need to store the value in Elastic DB and elastic snapshot like

```auto
{
        "_index": "employeestore",
        "_type": "employee",
        "_id": "AXsVtT9MfOtqK98N091A",
        "_score": 1,
        "_source": {
          "title": "xyz",
          "description": "abc",
           ----and so on dynamic value
        }

```

If i use automap like

```auto
esClient.Map<Employee>(m =>
            {
                var putMappingDescriptor = m.Index(Indices.Index("employeestore")).AutoMap();
                return putMappingDescriptor;
            })

```

the elastic snapshot has

"key": "title", "value": "xyz"

but i need like this

```auto
"_source": {
          "title": "xyz",
          "description": "abc",
           ----and so on dynamic value
        }

```

How we can we map the Employee class in Elastic which can accomodate arbitary fields?

---

<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:** [September 8, 2021, 11:02am UTC](https://discuss.elastic.co/t/how-to-map-dynamic-columns-of-a-class-in-elastic/281042/2 "2021-09-08T11:02:19Z")

</div>

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