CAST function not working on PPL

Hello,

I am trying to change the string type field to integer using CAST() by a query.

search source=index-yyyy-mm-dd | eval userID=cast(userID as int) | fields userID

but I am receiving error as follow.

{
“error”: {
“reason”: “Invalid Query”,
“details”: “Failed to parse query due to offending symbol [(] at: ‘source=index-yyyy-mm-dd | eval userID=cast(’ <— HERE… More details: Expecting tokens in {, ‘|’, ‘,’, ‘.’, ‘+’, ‘-’, ‘*’, ‘/’, ‘%’}”,
“type”: “SyntaxCheckException”
},
“status”: 400
}

Can someone pls guide where am I going wrong?

i’m not able to reproduce, maybe try to escape field name? if that didn’t work, could you post a mapping and sample doc for index-yyyy-mm-dd?

POST cast/_doc
{
  "name": "123"
}

POST /_plugins/_ppl
{
  "query": "source = `cast` | eval `num` = cast(`name` as int)"
}

{
  "schema": [
    {
      "name": "name",
      "type": "string"
    },
    {
      "name": "num",
      "type": "integer"
    }
  ],
  "datarows": [
    [
      "123",
      123
    ]
  ],
  "total": 1,
  "size": 1
}