Sort order on mvel script

When I run the following script to retrieve the lists in size order

GET indexname/_search
{
"sort" : {
"_script" : {
"script" : "_source.list.size()",
"type" : "string",
"order" : "desc"
}
}
}

The script is using ASCII sort order on the results from size()

So 9 is first or 99
then 8 or 888
Then 7 or 7777

I need to cast the return to integer somehow or tell the script to use integer?

You should be able to do this by simply changing type to number instead of string. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_script_based_sorting for an example

Gosh that works.
I tried integer, int but didn't think to use number