Visualize: Unsupported script value when I use Visualization

I create a scripted fields ,it can be show normally,but can't visualiz.
script code :
if(doc['ifSelfShop'].value==1){ return "自营"; }else{return "pop";}
It's can work;


Error

Visualize: Unsupported script value [pop]
it's seems has som question。
My kibana and es version is 5.6.4。

It appears that scripted fields are not supported by visualize in v5.6.4.

How are the documents being ingested? Perhaps you could calculate the field at the point of ingestion.

Otherwise you could consider upgrading for wider scripted field support - https://www.elastic.co/guide/en/kibana/current/kuery-query.html

thank you