I am creating a dynamic object. I am assigning values ββthrough an IDictionary. Add collections of the IDictionary to the object. Then I add the dynamic object to Elastic Search using the NEST code. This throws a stackoverflow exception. "An unhandled exception of type" System.StackOverflowException "occurred in mscorlib.dll"
Here is what I have tried.
var node = new Uri("http://localhost:9200"); var settings = new ConnectionSettings(node,defaultIndex: "test-index"); var client = new ElasticClient(settings); try { dynamic x = new ExpandoObject(); Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("NewProp", "test1"); dic.Add("NewProp3", "test1"); x = dic; var index3 = client.Index(x); } catch (Exception ex) { string j = ex.StackTrace; }
I need to create an index in ElasticSearch using a dynamic object, because I will have an Excel workbook consisting of more than 300 sheets, and each sheet will be named as a type, and the contents inside the sheet will be the source.
In the above "x" example, the created dynamic object is the name of the worksheet, and the values ββadded to the dictionary are the rows and columns of the excel sheet.
Where am I mistaken.
Regards, Hema
source share