Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
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: 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 24 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.