Where to specify "MaxRetry" and "Timeout" variables in the Elasticsearch / Nest Bulk API? -
question: specify bulk operation "maxretry" or "timeout" variables used in nest bulk api?
when following bulk operation, program stops after inserting 60k records. got maxretryexception in elasticsearch.net.connection.requesthandlers.requesthandlerbase.cs. so, thinking increase maxretry number or timeout seconds overcome problem, on right path?
var counter = 0; var indexname = "someindexname"; var indextype = "sometype"; var routingstring = "somerouting"; var bulkdescriptor = new bulkdescriptor(); while (await result.readasync()) { counter++; var document = getdocumentobject<t>(result); var idstring = getid(result); bulkdescriptor.index<t>(op => op .routing(routingstring) .index(indexname) .type(indextype) .id(idstring) .document(document)); if (counter % 1000 == 0) { var bulkresponse = await client.bulkasync(bulkdescriptor); bulkdescriptor = new bulkdescriptor(); } }
i tested , how specify timeout & max retries:
var connectionsettings = new connectionsettings(_connectionpool) .settimeout(1000*30) // 30 minutes timeout .maximumretries(5); // 5 times retry var client = new elasticclient(connectionsettings);
Comments
Post a Comment