Elasticsearch 6 painless query exception

FWIW, I also found an old discussion, Long field is returned as integer if the value is less in Java API where they discussed a reverse problem. long to integer while in my case it is integer to long and I don't use Java API