Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thedeveloper/http-aws-es
Use the elasticsearch-js client with Amazon ES
https://github.com/thedeveloper/http-aws-es
amazon-elasticsearch aws-sdk elasticsearch elasticsearch-js
Last synced: 6 days ago
JSON representation
Use the elasticsearch-js client with Amazon ES
- Host: GitHub
- URL: https://github.com/thedeveloper/http-aws-es
- Owner: TheDeveloper
- License: mit
- Created: 2015-10-04T15:36:01.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T09:45:55.000Z (about 2 years ago)
- Last Synced: 2024-12-21T04:05:42.437Z (13 days ago)
- Topics: amazon-elasticsearch, aws-sdk, elasticsearch, elasticsearch-js
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/http-aws-es
- Size: 234 KB
- Stars: 262
- Watchers: 9
- Forks: 129
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Deprecated
Newer version available at [aws-elasticsearch-js](https://github.com/gosquared/aws-elasticsearch-js) for more recent versions of Elasticsearch and elasticsearch-js.---
# Connection handler for Amazon ES [](https://www.npmjs.org/package/http-aws-es)
Makes [elasticsearch-js](https://github.com/elastic/elasticsearch-js) compatible with Amazon ES. It uses the aws-sdk to make signed requests to an Amazon ES endpoint.## Installation
```bash
# Install the connector, elasticsearch client and aws-sdk
npm install --save http-aws-es aws-sdk elasticsearch
```## Usage
```javascript
// 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:```javascript
let AWS = require('aws-sdk');
AWS.config.update({
credentials: new AWS.Credentials(accessKeyId, secretAccessKey),
region: 'us-east-1'
});
```## Options
```javascript
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
```bash
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
```