Reindexing data to elasticSearch cloud

Continuing the discussion from Cloud elastic account,Reindex docs:
until now I used elasticsearch cloud version below 7.5, and now when i tried reindex my data to elastic search cloud with same code it didn't reindex, even didn't create index. My backend asp.net core and i use NEST 7.4.2, here is my code:

public static void AddElasticsearch(
        this IServiceCollection services, IConfiguration configuration)
    {
        var url = configuration["https://f3bf62---------------------68a99a39.europe-west1.gcp.cloud.es.io:9243"];
        var defaultIndex ="honadonz12";
       
        var list = new List<string>();
        var settings = new ConnectionSettings(

            new Uri("https://f3bf62--------------------68a99a39.europe-west1.gcp.cloud.es.io:9243"))
            .DefaultIndex(defaultIndex)
         
            .BasicAuthentication("elastic", "Ghil-------------ELVBbwwG")

            
              
.DisableDirectStreaming() 
.OnRequestCompleted(apiCallDetails => 
{
    // log out the request and the request body, if one exists for the type of request
    if (apiCallDetails.RequestBodyInBytes != null)
    {
        list.Add(
            $"{apiCallDetails.HttpMethod} {apiCallDetails.Uri} " +
            $"{Encoding.UTF8.GetString(apiCallDetails.RequestBodyInBytes)}");
    }
    else
    {
        list.Add($"{apiCallDetails.HttpMethod} {apiCallDetails.Uri}");
    }

    // log out the response and the response body, if one exists for the type of response
    if (apiCallDetails.ResponseBodyInBytes != null)
    {
        list.Add($"Status: {apiCallDetails.HttpStatusCode}" +
                 $"{Encoding.UTF8.GetString(apiCallDetails.ResponseBodyInBytes)}");
    }
    else
    {
        list.Add($"Status: {apiCallDetails.HttpStatusCode}");
    }
});

        AddDefaultMappings(settings);

        var client = new ElasticClient(settings);

        services.AddSingleton<IElasticClient>(client);

        CreateIndex(client, defaultIndex);
    }

    private static void AddDefaultMappings(ConnectionSettings settings)
    {
        settings
            .DefaultMappingFor<ElasticSearchModel>(m => m);
               
    }

    private static void CreateIndex(IElasticClient client, string indexName)
    {
        if (!client.Indices.Exists(indexName).Exists)
        {
        var createIndexResponse = client.Indices.Create(indexName, c => c
                      .Map<ElasticSearchModel>(mm => mm
                     .AutoMap()
                        )
                        .RequestConfiguration(r => r
                        .DisableDirectStreaming()
)
              );

               Console.WriteLine("Writeline is :" + createIndexResponse);}
    }
}

Error: Writeline is :Invalid NEST response built from a unsuccessful () low level call on PUT: /honadonz12

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.