33 lines
827 B
Plaintext
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);
|
|
----
|