Date comparison in painless script

Hey there,

I am new to Elastic search. I am trying to update a record by using _update_by_query API, by using a painless script as below.

"script": {
    "source": "if(ctx._source.global_cro_dist_due < params.current){ctx._source.oud_modified_by = 'SYSTEM2'}",
    "lang": "painless",
    "params" : {
      "current" : "2020-03-24T13:32:00"
    }
}

But, the above script is giving me below error.

"caused_by": {
      "type": "illegal_argument_exception",
      "reason": "field [java.lang.System, currentTimeInMillis] not found"
}

Any thought or solution is most welcome and appreciated.

Note: Basically, i am stuck in comparing dates in if clause. Please help me to resolve this.

That is a weird one, given the fact, that you are not calling currentTimeMillis in your script.

First, which Elasticsearch version is this on?

Second, can you create a minimal reproducible example, that contains index creation/mapping, document indexing and the full script call, so one could reproduce locally?

Thank you!