
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
es-painless-fields
Advanced tools
Helpers for bulk update Elasticsearch documents by query using Painless scripts
Helpers for bulk update Elasticsearch documents by query using Painless scripts
$ yarn add es-painless-fields
The main purpose is to utilize _update_by_query
Elasticsearch API most efficiently.
API is limited to updating documents in-place by scripts, so you cannot rely on ES to replace document by passing partial parameters. This package aims to ease partial bulk document updates.
const esClient = require('elasticsearch').Client();
const painlessFields = require('es-painless-fields');
const script = painlessFields.set({a: 1, b: 2});
esClient.updateByQuery({
conflicts: 'proceed',
body: {
query: {match_all: {}},
script
}
});
Type: Object
Object fields which you would like to set. Example: {a: 1, b: 2}
Also can be in a flat form, like {'a.b.c': 1}
Type: String[]
Array of field names which you would like to unset. Example: ['a', 'b'']
Type: Object
Object fields which you would like to increment. Example: {a: 1, b: 2}
Also can be in a flat form, like {'a.b.c': 1}
Type: Object
Object fields which you would like to decrement. Example: {a: 1, b: 2}
Also can be in a flat form, like {'a.b.c': 1}
Type: Object
Object fields which you would like to multiply. Example: {a: 1, b: 2}
Also can be in a flat form, like {'a.b.c': 1}
Type: Object
Object fields which you would like to divide. Example: {a: 1, b: 2}
Also can be in a flat form, like {'a.b.c': 1}
Type: Array
Array of objects describing what to replace. Example:
const fieldsReplacements = [
{field: 'a', pattern: 'foo', substring: 'bar'},
{field: 'b', pattern: 'hello', substring: 'world'}
];
Returns a script which replaces fields by pattern with substrings. Example:
{
"lang": "painless",
"source": "ctx._source.a = ctx._source.a.replace(params.patterns[0], params.substrings[0]); ctx._source.b = ctx._source.b.replace(params.patterns[1], params.substrings[1]);",
"params": {
"patterns": ["foo", "hello"],
"substrings": ["bar", "world"]
}
}
MIT © Shelf
FAQs
Helpers for bulk update Elasticsearch documents by query using Painless scripts
We found that es-painless-fields 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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.