
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
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: 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 © Vlad Holubiev
FAQs
Helpers for bulk update Elasticsearch documents by query using Painless scripts
The npm package es-painless-fields receives a total of 15 weekly downloads. As such, es-painless-fields popularity was classified as not popular.
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.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.