Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
elasticsearch-required
Advanced tools
A plugin for the Elasticsearch JavaScript client that enforces required fields when indexing
Elasticsearch does not come with built-in support for specifying certain fields as required. This plugin module adds this capability to the Elasticsearch JavaScript client by checking the data before it is indexed.
Note that "required" in this case does not mean "truthy", but rather that the field is specified. That is, null
is still a valid value.
Use this plugin in conjunction with elasticsearch-non-nullable to enforce required, non-nullable fields.
To install elasticsearch-required
npm install elasticsearch
npm install --production elasticsearch-required
This plugin augments client.indices.putMapping()
to allow for the specification of required fields. As such, it is required that you call putMapping
on every instance of the Elasticsearch client before indexing so that the plugin can be initialized with what fields are required.
The following example demonstrates putting the mapping and indexing:
var Client = require('elasticsearch').Client;
require('elasticsearch-required');
// create the client
var client = ...
// put the mapping with "required" property
client.putMapping({
"index" : "test",
"type" : "tweet",
"body" : {
"tweet" : {
"properties" : {
"message" : {
"type" : "string",
"required" : true
}
}
}
}
}).then(function () {
// the following with result in "missing required field" error
return client.index({
"index" : "test",
"type" : "tweet",
"body" : {
}
});
});
To run the unit tests
npm test
putMapping()
when multiple indices are specifiedMIT
FAQs
A plugin for the Elasticsearch JavaScript client that enforces required fields when indexing
The npm package elasticsearch-required receives a total of 0 weekly downloads. As such, elasticsearch-required popularity was classified as not popular.
We found that elasticsearch-required 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.