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?

2
  • 1
    stackoverflow.com/questions/26744742/… ? Commented Aug 20, 2015 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) Commented Aug 20, 2015 at 14:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.