private static BulkLoadResponse LoadIndex(string fileName) { var bulkResponse = new BulkLoadResponse(); int recordsPerLoad = 5000; var orders = GetAllOrders(fileName); var search = new FlnSearch.AwsSearch(); var remainingCount = orders.Count(); var startIndex = 0; while (remainingCount > 0) { var count = remainingCount > recordsPerLoad ? recordsPerLoad : remainingCount; var batch = orders.GetRange(startIndex, count); Console.WriteLine(string.Format("\tprocessing records :{0} thru {1}...", startIndex, startIndex + count)); var response = search.BulkLoad(batch); bulkResponse.RecordsInBatch += response.RecordsInBatch; Console.WriteLine(string.Format("\t\tProcess took: {0}", response.Took)); if (response.Errors) { bulkResponse.Errors = true; bulkResponse.FailedItems.AddRange(response.FailedItems); Console.WriteLine(string.Format("\t{0} errors found", response.FailedItems.Count)); } remainingCount -= count; startIndex += count; } return(bulkResponse); }
private static void LoadRange(string fileName, int startIndex, int count) { var orders = GetAllOrders(fileName); var seaexh = new FlnSearch.AwsSearch(); var batch = orders.GetRange(startIndex, count); seaexh.BulkLoad(batch); }