# \[Kibana\]Y-AxisのJSON inputについて

**URL:** <https://discuss.elastic.co/t/kibana-y-axis-json-input/161434>\
**Category:** 日本語による質問・議論はこちら\
**Created:** [December 19, 2018, 3:28am UTC](https://discuss.elastic.co/t/kibana-y-axis-json-input/161434 "2018-12-19T03:28:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)\
**Post date:** [December 19, 2018, 5:15am UTC](https://discuss.elastic.co/t/kibana-y-axis-json-input/161434/2 "2018-12-19T05:15:47Z")

</div>

こんにちわ

## json inputについて

> [@Apply a script on an aggregation result in visualization](https://discuss.elastic.co/t/apply-a-script-on-an-aggregation-result-in-visualization/107052):
>
> Hello, I have a visualization on Kibana of type "Data table", I need to apply a simple script on the count aggregations result (divied count by 2). I tried to embed a script in advanced JSON like this : { "script" : "doc['count'].value / 2" } But, it doesn't like having any affect on my results Any thought about how to make it ? Thanks in advance for your help !

こちらによりますと、

> The script parameter defines an inline script, which operates against each _document_ , and not the result of the aggregation. So you can't use it to accomplish what you're trying to do.

と書いてあり、Aggregationの結果に対しての操作をするものじゃないよ、と読めます。  
今回は、avgやsumなどではなくcountした値を式にかけたい、ということだったので、このアプローチを止めて下に紹介するTimeSeriesを確認してみました。

## Visual Builderでの例

もし、標準のLineチャートでなければだめだ、ということがなければ、VisualBuilderで作成することができるTimeSeriesでは如何でしょうか。  
Countに、AggregationでMath を追加することでやりたいことができるのでは？と思います。  
以下では、分かりやすいように、件数を10倍して描画する例を確認しています。

カウントだけを描画した例

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7ed0c138544907e88b82ef81bc3abeedeb44304b.png)

カウント件数を10倍して描画した例

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/a/eaf7d0a030b909b34182d78fc914a3545f60314a.png)

参考になったdiscuss

> [@How to multiply 2 with count result](https://discuss.elastic.co/t/how-to-multiply-2-with-count-result/139509/2):
>
> You can use the Metric tab in the Visual Builder where you can do math calculations on the count aggregation. Here's an example:

ご参考になれば幸いです。

---

_[View the full topic](https://discuss.elastic.co/t/kibana-y-axis-json-input/161434)._
