Files
elasticsearch-js/docs/doc_examples/2408020186af569a76a30eccadaed0d5.asciidoc
2024-07-29 17:10:05 -05:00

33 lines
827 B
Plaintext

// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ingest.simulate({
pipeline: {
processors: [
{
script: {
description: "Extract 'tags' from 'env' field",
lang: "painless",
source:
"\n String[] envSplit = ctx['env'].splitOnToken(params['delimiter']);\n ArrayList tags = new ArrayList();\n tags.add(envSplit[params['position']].trim());\n ctx['tags'] = tags;\n ",
params: {
delimiter: "-",
position: 1,
},
},
},
],
},
docs: [
{
_source: {
env: "es01-prod",
},
},
],
});
console.log(response);
----