Skip to content

Repository files navigation

Deprecated

Newer version available at aws-elasticsearch-js for more recent versions of Elasticsearch and elasticsearch-js.


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 ESletes=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:

letAWS=require('aws-sdk');AWS.config.update({credentials: newAWS.Credentials(accessKeyId,secretAccessKey),region: 'us-east-1'});

Options

letoptions={hosts: [],// array of amazon es hosts (required)connectionClass: require('http-aws-es'),// use this connector (required)awsConfig: newAWS.Config({ region }),// set an aws config e.g. for multiple clients to different regionshttpOptions: {}// set httpOptions on aws-sdk's request. default to aws-sdk's config.httpOptions};letes=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

About

Use the elasticsearch-js client with Amazon ES

Topics

Resources

Stars

260 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages