Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@condor-labs/elasticsearch
Advanced tools
This module provide and usefull helper to use Elasticsearch library
This module provide and usefull helper to use Elasticsearch library.
See official documentation here.
The minimum supported version of Node.js is v8.
The library is compatible with all Elasticsearch versions since 5.x
To use the library you just need to follow the following steps Install the library with npm
npm install @condor-labs/elasticsearch
Import the library:
const elasticsearch = require('@condor-labs/elasticsearch')(settings);
settings
object propertiesProperty | Default | Description |
---|---|---|
protocol (String) | http | Specify http protocol |
host (String) | 127.0.0.1 | The host name of the ES instance you are connecting to. |
port (Number) | 9200 | The port number to connect to. |
user (String) | The username for authentication. | |
password (String) | The password for authentication. |
constants.js
module.exports = {
settings: {
protocol: 'http',
user: '',
password: '',
host: 'localhost',
port: 9200
},
indexBody: {
index: 'game-of-thrones',
type: 'characters',
body: {
character: 'Ned Stark',
quote: 'Winter is coming.'
}
},
searchBody: {
size: 100,
from: 0,
body: {
query: {
match: {
character: 'Stark'
}
}
}
}
};
index.js
const {
settings,
indexBody,
searchBody
} = require('./constants');
try {
const es = require('@condor-labs/elasticsearch')(settings);
(async () => {
// get client
let client = es.getClient();
//----------------
// Let's start by indexing some data
//----------------
let resp = await client.index(indexBody)
// validate response
console.log(resp && resp.statusCode === 201 ? "Saving document is OK!" : "Saving document didn't work :(");
console.log('---------------------------------------');
//----------------
// search data just added:
//----------------
// promise API
resp = await client.search(searchBody);
console.log(resp && resp.body && resp.body.hits && resp.body.hits.total > 0 ? `${resp.body.hits.total} Docs found via Promise!!!` : `NO Docs found via promises :( `);
console.log('---------------------------------------');
resp = await client.search(
searchBody,
(err, resp) => {
if (err) {
console.error(err)
}
console.log(resp && resp.body && resp.body.hits && resp.body.hits.total > 0 ? `${resp.body.hits.total} Docs found via CB!!!` : `NO Docs found via CB :( `);
console.log('---------------------------------------');
// close app
process.exit(1);
}
);
})();
} catch (error) {
console.error(error)
}
You will need to update the package.json
file placed in the root folder.
identify the property version
and increase the right number in plus one.
npm login
[Enter username]
[Enter password]
[Enter email]
If all is ok the console will show you something like this : Logged in as USERNAME on https://registry.npmjs.org/.
npm publish --access public
Ref: https://docs.npmjs.com/getting-started/publishing-npm-packages
Note: you will need to have a NPM account, if you don't have one create one here: https://www.npmjs.com/signup
The original author and current lead maintainer of this module is the @condor-labs development team.
More about Condorlabs Here.
FAQs
This module provide and usefull helper to use Elasticsearch library
We found that @condor-labs/elasticsearch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.