0

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?

Amin Merati
  • 2,221
  • 4
  • 22
  • 38
  • 1
    http://stackoverflow.com/questions/26744742/index-a-dynamic-object-using-nest ? – atlaste Aug 20 '15 at 14:43
  • Thanks for that. However, there problem with answer is that with dynamic class, how can we specify the property name variable each time? You can specify a property but the name of property is hard coded (fixed) – Amin Merati Aug 20 '15 at 14:52

0 Answers0