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

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);
----