3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kibana4のVisualizationでTermsAggregationの結果をURLDecodeする方法

Posted at

なんだか色々あってくっそ悩んだのでメモ。

まず以下のファイルを/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されて表示される。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?