Painless compare string dates

Hi,

I need compare two dates in painless script inline to update documents. I try in Kibana Console:

GET indexName/Type/1111/_update
{
  "script":{
    "lang": "painless",
    "inline": "ctx._source.accounts.removeIf(i -> i.accountId == params.newobject.accountId && i.expirationDate < params.newobject.expirationDate);
ctx._source.accountsVisibility.add(params.newobject);",
    "params": {
      "newobject":{
        "accountId": 3,
        "expirationDate": "2017-09-18T18:42:39.965Z"
       }
    }
  }
}

But i get error

class_cast_exception: Cannot apply [<] operation to types [java.lang.String] and [java.lang.String]

How I convert the string to date for compare in script?

Thanks.

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