Skip to content
Use the elasticsearch-js client with Amazon ES
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src use AWS XHRClient in browser Nov 25, 2017
test use AWS XHRClient in browser Nov 25, 2017
.eslintrc
.gitignore use AWS XHRClient in browser Nov 25, 2017
CHANGELOG.md upgrade elasticsearch-js to 15.x May 19, 2018
LICENSE Env credentials (#27) Jun 20, 2017
README.md Update README Oct 22, 2017
connector.js use AWS XHRClient in browser Nov 25, 2017
package-lock.json upgrade elasticsearch-js to 15.x May 19, 2018
package.json upgrade elasticsearch-js to 15.x May 19, 2018

README.md

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

# Install the connector, elasticsearch client and aws-sdk
npm install --save http-aws-es aws-sdk elasticsearch

Usage

// create an elasticsearch client for your Amazon ES
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: [], // array of amazon es hosts (required)
  connectionClass: require('http-aws-es'), // use this connector (required)
  awsConfig: new AWS.Config({ region }), // set an aws config e.g. for multiple clients to different regions
  httpOptions: {} // set httpOptions on aws-sdk's request. default to aws-sdk's config.httpOptions
};
let es = require('elasticsearch').Client(options);

Test

npm test
# test against a real endpoint
AWS_PROFILE=your-profile npm run integration-test -- --endpoint https://amazon-es-host.us-east-1.es.amazonaws.com --region us-east-1
You can’t perform that action at this time.