I am trying to send data to Elasticsearch using NEST and ASP.NET Core that contains mainly text and XML data.
My class is defined as follow:
public class TestData
{
public string text1{ get; set; }
public string text2{ get; set; }
public string text3{ get; set; }
public Object obj { get; set; }
}
Here's the quick sample to populate data:
public class myXML
{
public string field1 { get; set;}
public string field2 { get; set;}
}
public static List<TestData> SampleData()
{
XmlSerializer xmlobj = new XmlSerializer(typeof(myXML));
myXML data = new myXML();
data.field1= "field1";
data.field2 = "field2";
var xmlString = new StringWriter();
xmlobj .Serialize(xmlString, data);
return new List<TestData>
{
new TestData { text1="text1", text2 = "text2", text3 = "text3", obj= xmlString }
}
}
I am inserting the data as follow
var Samples = SampleData();
var result = client.IndexManyAsync(Samples );
I do have the index created just fine with all the fields in TestData mapped correctly. However, when i create an index pattern with Kibana, I do not see the data being inserted.
I was hoping that ElasticSearch would also parse the XML in separate fields.
Are there any examples of inserting XML data to Elasticsearch using .NET with either NEST or Elasticsearch.net low level API ?