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の場合は結果に含まれない
その違いで平均値が変わってくることがわかった