Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
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
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.