Kibana の JSON input の使い方を調べる
簡単な説明は上のドキュメントより
JSON Input
A text field where you can add specific JSON-formatted properties to merge with the aggregation definition, as in the following example:
{ "script" : "doc['grade'].value * 1.2" }
上の例はgrade
フィールドを1.2倍にして表示している
こんな風につかうらしい
他にどういうjsonのオプションが使えるのか
Aggregationの種類分あるみたい
Avg Aggregation
https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-metrics-avg-aggregation.html
Sum Aggregation
https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-metrics-sum-aggregation.html
他
https://www.elastic.co/guide/en/elasticsearch/reference/7.4/search-aggregations-metrics.html
気になる検証
A: filedではprice
を指定し、scriptではrating
の値を指定して平均値を算出する
B: filedでrating
を指定して平均値を算出する
この場合、AとBに違いがでるのか?
どちらもrating
の平均値だが、微妙に違った
考えてみたが、Aはprice
で集約してrating
の平均値を計算しているので、price
がnullの場合は結果に含まれない
その違いで平均値が変わってくることがわかった