Reputation: 1379
I am trying to insert\bulk insert data to Elastic using NEST API.
Can someone provide me the example using NEST?
Thanks, Sameer
Upvotes: 1
Views: 4051
Reputation: 9979
NEST documantation contains examples how to do this e.g.:
var descriptor = new BulkDescriptor();
foreach (var i in Enumerable.Range(0, 1000))
{
descriptor.Index<ElasticSearchProject>(op => op
.Document(new ElasticSearchProject {Id = i})
);
}
var result = client.Bulk(descriptor);
Also you can use IndexMany
which is quite useful
var documents= new List<ElasticSearchProject> {...};
client.IndexMany(documents);
Good luck.
Upvotes: 3