Current timestamp in Kibana Dev Tools

Hi All,

Apologies if this question has already been answered. Is it possible to create a new document using the Kibana Dev Console and set the timestamp field to now, much in the same way as datetime.now() in python.

POST index_name/_doc
{
    "field1": "some text",
    "timestamp": datetime.now() # I know this is python but bear with me for explanation purposes
}

Any help would be greatly appreciated! Thanks :slight_smile:

Hi there, I think you can use a custom ingest pipeline to achieve it.
In the console, create your pipeline:

PUT _ingest/pipeline/add_timestamp
{
  "description": "Adds timestamp",
  "processors": [
    {
      "set": {
        "field": "_source.timestamp",
        "value": "{{_ingest.timestamp}}"
      }
    }
  ]
}

Then, create your index in the console along with a setting default_pipeline:

PUT indexName/_settings
{
  "index": {
    "default_pipeline": "add_timestamp"
  }
}

Now every document will receive a timestamp.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.