Skip to content

bcuff/elasticsearch-net-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elasticsearch Net for Amazon AWS

Add-on to elasticsearch-net / NEST for using AWS's elasticsearch service.

Install Package

On Nuget

# For ElasticSearch.Net >= 2.0.2
Install-Package Elasticsearch.Net.Aws
# or for dotnet core
dotnet add package Elasticsearch.Net.Aws

# For ElasticSearch.Net 1.X
Install-Package Elasticsearch.Net.Aws-v1
# or for dotnet core
dotnet add package Elasticsearch.Net.Aws-v1

Setup

Elasticsearch.Net Version >= 2.0.2

Use Package Elasticsearch.Net.Aws

// for NEST

// if using an access key
var httpConnection = new AwsHttpConnection("us-east-1", new StaticCredentialsProvider(new AwsCredentials
{
	AccessKey = "My AWS access key",
	SecretKey = "My AWS secret key",
}));

// if using app.config, environment variables, or roles
var httpConnection = new AwsHttpConnection("us-east-1");

var pool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var config = new ConnectionSettings(pool, httpConnection);
var client = new ElasticClient(config);

Elasticsearch.Net Version 1.7.1

Use Package Elasticsearch.Net.Aws-v1

Source for this version is maintained on the version-1 branch

// for NEST
var client = new ElasticClient(settings, connection: new AwsHttpConnection(settings, new AwsSettings
{
	AccessKey = "My AWS access key",
	SecretKey = "My AWS secret key",
	Region = "us-east-1",
}));

The AwsHttpConnection class is an implemenation of IConnection that will sign the HTTP requests according to the Version 4 Signing Process.

Serilog Sink Setup

  const string esUrl = "https://aws-es-thinger.us-west-1.es.amazonaws.com";
  Log.Logger = new LoggerConfiguration()
                .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(esUrl))
                {
                    ModifyConnectionSettings = conn =>
                    {
                        var httpConnection = new AwsHttpConnection("us-east-1");
                        var pool = new SingleNodeConnectionPool(new Uri(esUrl));
                        return new ConnectionConfiguration(pool, httpConnection);
                    }
                })
                .CreateLogger();

About

Add-on to Elasticsearch.Net & NEST for using AWS's elasticsearch service.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 9

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy