Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
elasticsearch-non-nullable
Advanced tools
Readme
Elasticsearch does not come with built-in support for specifying certain fields as non-nullable. This plugin module adds this capability to the Elasticsearch JavaScript client by checking the data before it is indexed.
Note that "non-nullable" in this case does not mean "truthy" or "defined", but rather that the field cannot strictly equal null
. That is, undefined
is still a valid value.
Use this plugin in conjunction with elasticsearch-required to enforce required, non-nullable fields.
To install elasticsearch-required
npm install elasticsearch
npm install --production elasticsearch-non-nullable
This plugin augments client.indices.putMapping()
to allow for the specification of non-nullable 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 non-nullable.
The following example demonstrates putting the mapping and indexing:
var Client = require('elasticsearch').Client;
require('elasticsearch-non-nullable');
// create the client
var client = ...
// put the mapping with "non-nullable" property
client.putMapping({
"index" : "test",
"type" : "tweet",
"body" : {
"tweet" : {
"properties" : {
"message" : {
"type" : "string",
"non-nullable" : true
}
}
}
}
}).then(function () {
// the following with result in "null value" error
return client.index({
"index" : "test",
"type" : "tweet",
"body" : {
"message" : null
}
});
});
To run the unit tests
npm test
putMapping()
when multiple indices are specifiedMIT
FAQs
A plugin for the Elasticsearch JavaScript client that enforces non-nullable fields when indexing
The npm package elasticsearch-non-nullable receives a total of 3 weekly downloads. As such, elasticsearch-non-nullable popularity was classified as not popular.
We found that elasticsearch-non-nullable 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.