Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
How to configure client? AWS Elasticsearch request C#

I am new to Amazon Web Services. I configured domain to use ElasticSearch in AWS(Amazon Web Services) console. Confirured usage of Http Requests. Went through documantation of creating ElasticSearch client from https://www.elastic.co/guide/en/elasticsearch/client/net-api/1.x/security.html

var response = client.RootNodeInfo(c => c
    .RequestConfiguration(rc => rc
        .BasicAuthentication("UserName", "Password")
    ));

Works fine to me (Response is 200) But when i try to configure authentication credentials like this and pass config to client constructor i need to have "cloudId" i didnt find in at AWS where sould i search for it? or what i have to do?

My client code:

BasicAuthenticationCredentials credentials = new BasicAuthenticationCredentials("UserName", "Password");

var config = new ConnectionSettings("cloudId???", credentials);

var client = new ElasticClient(config);
var response = client.Ping();
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I recently did this but a different way. I used the Nuget package AwsSignatureVersion4 and an IAM user with appropriate permissions to the ElasticSearch service.

But basically, use the ImmutableCredentials and just do what I need to do via the REST calls and the C# HttpClient. I find it easier than using the .NET ElasticSearch library. I can then copy/paste back and forth from Kibana.

var credentials = new ImmutableCredentials("access_key", "secret_key", null);
HttpContent httpContent = new StringContent(JsonConvert.SerializeObject(someObjOrQuery), Encoding.UTF8);
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var resp = httpClient.PostAsync(es_url, 
    httpContent, 
    regionName: "us-east-1",
    serviceName: "es",
    credentials: credentials).GetAwaiter().GetResult();

if(resp.IsSuccessStatusCode) 
{
   //Good to go
}
else
{
  //this gets what ES sent back
  var content = response.Content.ReadAsStringAsync();
  dynamic respJson = JObject.Parse(content.Result());
  //Now you can access stuff by dot and it's dynamic respJson.something
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!