# Using The Advanced JSON Input For Filtering Data and Then Using The Intermediate Result As Part Of Calculations

**URL:** https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556
**Category:** Kibana
**Created:** [June 18, 2020, 3:39am UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556 "2020-06-18T03:39:20Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 18, 2020, 3:39am UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/1 "2020-06-18T03:39:20Z")

</div>

Hi, I made an earlier post on filtering the data within +/-300. I want to

1. Do an on-the-spot filtering of values that are within +/-300mm per data bucket. Log this as a count per data bucket.

2. Do a percentage calculation by count, per data bucket on the data column "Align\_Dist\_To\_Go" see the % of values that are within +/-300 range.

3. Display on the Bar Graph.

As you can see below, this is my legacy arrangement as of today. I can only cover the first case of values below +300. I cannot cover the other corner case to strike out values below -300.

I specifically want a percentage figure per data bucket on the # of values between +/-300 for "Align\_Distance\_To\_Go"

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

I want to try implementing this inside the Advanced JSON Input instead as a dynamic on site workaround.

Is it possible? I need this really badly. Thanks

How do i go about doing it?

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [June 24, 2020, 2:38pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/2 "2020-06-24T14:38:10Z")

</div>

The JSON input is not meant for this kind of purpose.

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 24, 2020, 3:04pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/3 "2020-06-24T15:04:31Z")

</div>

wat would the JSON input be more suitable for?

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [June 24, 2020, 3:15pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/4 "2020-06-24T15:15:48Z")

</div>

When a single aggregation has parameters that we don't have a UI for, you can extend just the one aggregation's JSON block. This can be used for the Percentiles aggregation, which doesn't have UI for the HDR percentile mode: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html#\_hdr\_histogram](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-percentile-aggregation.html#_hdr_histogram)

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 24, 2020, 3:17pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/5 "2020-06-24T15:17:23Z")

</div>

ok so i have to go into my ES query for that visualisation and manually paste that block of code in?

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [June 24, 2020, 3:22pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/6 "2020-06-24T15:22:25Z")

</div>

No, that wouldn't work because JSON input is not meant for writing an entire query.

---

<div class="post-metadata">

### Author: ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)
#### Post date: [June 24, 2020, 3:23pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/7 "2020-06-24T15:23:14Z")

</div>

ok. so how do i implement the HDR Histrogram then? I see an ES query eg inside the link u sent me. But whr will this code be residing when i actually wanna implement it.?

---

<div class="post-metadata">

### Author: ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)
#### Post date: [June 24, 2020, 3:26pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/8 "2020-06-24T15:26:22Z")

</div>

In that example you take just the part you want to _extend_ from our existing UI. For example:

```auto
{
  "hdr": { 
    "number_of_significant_value_digits" : 3 
  }
}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 22, 2020, 3:26pm UTC](https://discuss.elastic.co/t/using-the-advanced-json-input-for-filtering-data-and-then-using-the-intermediate-result-as-part-of-calculations/237556/9 "2020-07-22T15:26:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
