Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including http-aws-es with all npm packages installed. Try it out:

require("aws-sdk/package.json"); // aws-sdk is a peer dependency. require("elasticsearch/package.json"); // elasticsearch is a peer dependency. var httpAwsEs = require("http-aws-es")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

http-aws-es v6.0.0

Use the elasticsearch-js client with Amazon ES

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.


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


// create an elasticsearch client for your Amazon ES
let es = require('elasticsearch').Client({
  hosts: [ '' ],
  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');
  credentials: new AWS.Credentials(accessKeyId, secretAccessKey),
  region: 'us-east-1'


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);


npm test
# test against a real endpoint
AWS_PROFILE=your-profile npm run integration-test -- --endpoint --region us-east-1


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free