Connection handler for Amazon ES
Makes elasticsearch-js compatible with Amazon ES. It uses the aws-sdk to make signed requests to an Amazon ES endpoint.
Installation
npm install --save http-aws-es aws-sdk elasticsearch
Usage
let es = require('elasticsearch').Client({
hosts: [ 'https://amazon-es-host.us-east-1.es.amazonaws.com' ],
connectionClass: require('http-aws-es')
});
Region + Credentials
The connector uses aws-sdk's default behaviour to obtain region + credentials from your environment. If you would like to set these manually, you can set them on aws-sdk:
let AWS = require('aws-sdk');
AWS.config.update({
credentials: new AWS.Credentials(accessKeyId, secretAccessKey),
region: 'us-east-1'
});
Options
let options = {
hosts: [],
connectionClass: require('http-aws-es'),
awsConfig: new AWS.Config({ region }),
httpOptions: {}
};
let es = require('elasticsearch').Client(options);
Test
npm test
AWS_PROFILE=your-profile npm run integration-test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com --region us-east-1