27 lines
836 B
Plaintext
27 lines
836 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.putPipeline({
|
|
id: "my-timestamp-pipeline",
|
|
description: "Shifts the @timestamp to the last 15 minutes",
|
|
processors: [
|
|
{
|
|
set: {
|
|
field: "ingest_time",
|
|
value: "{{_ingest.timestamp}}",
|
|
},
|
|
},
|
|
{
|
|
script: {
|
|
lang: "painless",
|
|
source:
|
|
'\n def delta = ChronoUnit.SECONDS.between(\n ZonedDateTime.parse("2022-06-21T15:49:00Z"),\n ZonedDateTime.parse(ctx["ingest_time"])\n );\n ctx["@timestamp"] = ZonedDateTime.parse(ctx["@timestamp"]).plus(delta,ChronoUnit.SECONDS).toString();\n ',
|
|
},
|
|
},
|
|
],
|
|
});
|
|
console.log(response);
|
|
----
|