For the .net clients I dont see the option to wait for indexing to complete before returning the response when performing an IndexMany or IndexManyAsync. Its present for Index and IndexAsync.
Is there a way to specify this option when doing bulk inserts? Without it I have to write code that polls to see if all the millions of documents sent for bulk indexing were actually added.
IndexMany and IndexManyAsync are simple convenience methods over the Bulk API, so don't expose all of the options available. To set Refresh.WaitFor would be
var client = new ElasticClient();
var docs = new []
{
new { Name = "foo", Value = "bar" },
new { Name = "foo2", Value = "bar2" },
new { Name = "foo3", Value = "bar3" },
};
var bulkResponse = client.Bulk(b => b
.Index("my-index")
.Refresh(Refresh.WaitFor)
.IndexMany(docs)
);
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.