http-aws-es-di

1.1.6 • Public • Published

Connection handler for Amazon ES with dependency injection

Makes elasticsearch-js compatible with Amazon ES. It uses the aws-sdk to make signed requests to an Amazon ES endpoint. Define the Amazon ES config and the connection handler in the client configuration:

var es = require('elasticsearch').Client({
  hosts: 'https://amazon-es-host.us-east-1.es.amazonaws.com',
  connectionClass: require('http-aws-es')(AWS),
  amazonES: {
    region: 'us-east-1',
    accessKey: 'AKID',
    secretKey: 'secret'
  }
});

Alternatively you can pass in your own AWS Credentials object. This is particularly useful if running on AWS Lambda, since the appropriate credentials are already in the environment.

var myCredentials = new AWS.EnvironmentCredentials('AWS'); // Lambda provided credentials
var es = require('elasticsearch').Client({
  hosts: 'https://amazon-es-host.us-east-1.es.amazonaws.com',
  connectionClass: require('http-aws-es')(AWS),
  amazonES: {
    region: "us-east-1",
    credentials: myCredentials
  }
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.6
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.6
    2
  • 1.1.5
    0
  • 1.1.4
    0
  • 1.1.3
    0

Package Sidebar

Install

npm i http-aws-es-di

Weekly Downloads

2

Version

1.1.6

License

MIT

Last publish

Collaborators

  • cphoover