Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

http-aws-es

TheDeveloper110kMIT6.0.0TypeScript support: definitely-typed

Use the elasticsearch-js client with Amazon ES

elasticsearch, elasticsearch-js, aws-es, aws, amazon, es, http, connector, extension, sign

readme

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

changelog

6.0.0

  • Upgrade elasticsearch-js to 15.x

5.0.0

  • Depends on Elasticsearch-js 14.2.0 instead of 13.2.0 [#49][49]

4.0.0

  • Use AWS XHRClient in browser. #42

3.1.2

  • Fix unicode issue. #43

3.1.1

  • Fix DELETEs with request body e.g. clearScroll(). #19 #41
  • Reduce dependency footprint. #40

3.1.0

  • Allow aws config to be set per instance. #37
  • Add config for setting httpOptions on aws-sdk's requests. #8

3.0.0

  • Support down to node 4.x.

2.0.5

  • Catch aws credential errors. #35
  • Add source maps.

2.0.0

  • Load credentials from environment.

1.1.0

  • Added credentials option for passing in an AWS Credentials object.