
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
aws-elasticsearch-js
Advanced tools
Use Elastic's official elasticsearch-js with Amazon Elasticsearch.
npm i aws-elasticsearch-js
const elasticsearch = require('@elastic/elasticsearch');
const { createConnector } = require('aws-elasticsearch-js');
const region = process.env.AWS_REGION || 'us-east-1';
const domain = 'https://domain-1-abc123.region.es.amazonaws.com/';
const client = new elasticsearch.Client({
nodes: [ domain ],
Connection: createConnector({ region })
});
// use in the normal way
async function example() {
await client.index({ index: 'test', doc: { test: 'hello' } });
await client.indices.refresh();
let result = await client.search({ index: 'test' });
}
example();
The connector will use AWS credentials from the environment.
If you have another method of loading / refreshing credentials, you can pass them using getCreds
:
// heads up: this is called on every request
const getCreds = cb => {
// load creds from somewhere...
const credentials = { accessKeyId, secretAccessKey };
// or credentials = { sessionToken }
const err = null; // if you give an error, the request will abort
cb(err, credentials);
};
createConnector({ region, getCreds });
// options and example values
const options = {
region: 'us-east-1', // AWS region (defaults to process.env.AWS_REGION)
getCreds: cb => cb(err, credentials) // see above
};
createConnector(options);
# make sure aws creds are defined in the environment
AWS_REGION=us-east-1 \
AWS_ES_DOMAIN=https://domain-1-abc123.region.es.amazonaws.com/ \
npm test
If you get status code 403:
FAQs
Use elasticsearch-js with Amazon ES
The npm package aws-elasticsearch-js receives a total of 1,798 weekly downloads. As such, aws-elasticsearch-js popularity was classified as popular.
We found that aws-elasticsearch-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.