Unhandled exception. Elasticsearch.Net.ElasticsearchClientException: BulkAll halted after failed product check
at Nest.BlockingSubscribeExtensions.WaitOnObservable[TObservable,TObserve,TObserver](TObservable observable, TimeSpan maximumRunTime, Func`3 factory)
at Nest.BlockingSubscribeExtensions.Wait[T](BulkAllObservable`1 observable, TimeSpan maximumRunTime, Action`1 onNext)
I am getting this exception while trying to index a CSV to 3 node cluster.
here is my Code
using System;
using Elasticsearch.Net;
using Nest;
using Kuch_b;
using System.Security.Cryptography.X509Certificates;
namespace elasticsearch_client_example
{
internal class Testing
{
private const string Index_name = "data-v1";
private static async Task Main(string[] args)
{
var cert = new X509Certificate(@"PATH TO ca.pem FILE");
var uris = Enumerable.Range(9200, 1).Select(port => new Uri($"https://<VM IP>:{port}"));
var connectionPool = new StaticConnectionPool(uris);
var settings = new ConnectionSettings(connectionPool)
.BasicAuthentication("USER_NAME_FOR_ELASTIC", "PASSWORD_FOR_ELASTIC")
.EnableApiVersioningHeader()
.CertificateFingerprint("94:75:CE:4F:EB:05:32:83:40:B8:18:BB:79:01:7B:E0:F0:B6:C3:01:57:DB:4D:F5:D8:B8:A6:BA:BD:6D:C5:C4");
var client1 = new ElasticClient(settings);
var existResponse = await client1.Indices.ExistsAsync(Index_name);
if(!existResponse.Exists)
{
var createResponse = await client1.Indices.CreateAsync(Index_name, c => c
.Map(m => m.AutoMap<grades>()
.Properties<grades>( p => p.Keyword(k => k.Name(s => s.sSN)))
)
.Settings( s => s.NumberOfShards(4).NumberOfReplicas(1)));
try {
if (!createResponse.IsValid && !createResponse.Acknowledged)
Console.WriteLine("I am working dude");
}
catch (Exception ex )
{
Console.WriteLine(ex.ToString());
}
}
var bulkAll = client1.BulkAll(Read_Data(), r => r
.Index(Index_name)
.BackOffRetries(4)
.BackOffTime("30s")
.MaxDegreeOfParallelism(4)
.Size(10));
bulkAll.Wait(TimeSpan.FromMinutes(10), r => Console.WriteLine("HELLO "));
}
public static IEnumerable<grades>Read_Data()
{
var file = new StreamReader(@"PATH TO grades.csv");
string line;
while ((line = file.ReadLine()) != null)
{
Console.WriteLine(line);
yield return new grades(line);
}
}
}
CSV model Class:
public class grades
{
public string last { get; set; }
public string first { get; set; }
public string sSN { get; set; }
public string g_rade { get; set; }
public grades(string dataline)
{
var columns = dataline.Split(',', StringSplitOptions.TrimEntries);
last = columns[0];
first = columns[1];
sSN = columns[2];
g_rade = columns[3];
}
}
Elasticsearch8.2
Nest Version:7.17.4
Any Help will be much Appreciated: