By default Kibana 4 scripted fields use Lucene expressions, which currently only operate on numeric fields.
You can turn on static Groovy scripts, which have more advanced scripting functionality (note dynamic Groovy scripts are no longer recommended) -- for more discussion on how to do that in Kibana 4 please see this thread.