Normal way of inserting a document into Elastic Search in C# using NEST is to define a class with known properties where the property names and their attributes are fixed.
[ElasticType(Name = "DataRecord")]
public class DataRecord : DocumentMapping
{
[ElasticProperty(Store = false, Index = FieldIndexOption.NotAnalyzed)]
public string HistoryId { get; set; }
[ElasticProperty(Store = false, Index = FieldIndexOption.NotAnalyzed)]
public DateTime DateTime { get; set; }
[ElasticProperty(Store = false, Index = FieldIndexOption.No)]
public List<ChannelValues> ChannelsValues { get; set; }
}
How about if I want to change the number of properties of this class and the and their name in the run time?