なんだか色々あってくっそ悩んだのでメモ。
まず以下のファイルを/etc/elasticsearch/scripts
(elasticsearch.ymlのある場所)に置く。
uri_decode.groovy
import java.net.*
try {
URLDecoder.decode(_value, 'UTF-8')
} catch(e){
_value
}
全てのデータノードに同じファイルを置いてから60秒ほど待つと、このスクリプトがESで参照できるようになる。
あとはKibana4のVisualizeを編集する際に、Aggregationの項目でTermsを選び、任意のFieldについてそのJSON Inputに以下を入力する。
{"script_file":"uri_decode"}
こうすると結果が(URLDecoderがUTF-8でdecode可能な場合に)URLDecodeされて表示される。