How to Map dynamic columns of a class in Elastic

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

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

If i use automap like

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

"_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?

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