How to create new visualization using scripted field

HI Team,
I have successfully generated number scripted field and i need to create visualization by using that field. whenever i try to achieve that way im getting below detail
" No results displayed because all values equal 0." along with this error "1 of 5 shard failed". Im using version 6.4.0

Anyone can help me on this issue.

Can you check the simulation of the scripted field in the "edit/create scripted field" page? You can see there how it works on your documents.

Please find my below image,

It doesn't look like it's returning any values from the scripted field in that preview. Can look in more results to see if it does there?

HI,
Currently, i've only one entry in my index and scripted field returning the userid from the message and please find my message and script for your reference,

if (doc["data.keyword"].value != null){ def m = /UserID: ([0-9]+)/.matcher(doc["data.keyword"].value); if (m.find ()) { return m.group (1) } else { return "no match" } } else { return "NULL"}

2020-03-12 14:25:21:692 Logger - Received JSON Response: UserID: 624646, UserAgent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko