Skip to content

ctx._now time seems to be incorrect #23169

Closed
@seang-es

Description

@seang-es

To repro:

Create a document, then update it as follows:

POST my-index/my-type/1/_update
{
   "script" : {
       "inline": "ctx._source.timestamp_now = ctx._now; ctx._source.epochms = new Date().getTime();",
       "lang": "painless"
   },
   "upsert" : {
       "foo":"bar"
   }
}

In the results we're seeing, epochms is correct, but timestamp_now seems to be a random time. The ctx._now time is consistently increasing, but on various different nodes it has returned times ranging from 2003 to 2019.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions