# Using JSON Input in a vizualisation to create my own range aggregation

**URL:** <https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190>\
**Category:** Kibana\
**Created:** [June 11, 2019, 12:45pm UTC](https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190 "2019-06-11T12:45:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lobotomeh](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lobotomeh](https://discuss.elastic.co/u/lobotomeh)\
**Post date:** [June 11, 2019, 12:45pm UTC](https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190/1 "2019-06-11T12:45:52Z")

</div>

Hello everyone,

I try to make a range aggregation only on a precise part of a text field (in bold in the exampe below).

The field looks like this :  
`message_log: "::1:59882||Upload||efd_prel||D083748||PM011||R||` **0,1092014** `||OK||Validation des propriétés"`

Unfortunately, I can't change this field. The company wants it to be that way.  
I was asked to use the bold part (here : || **0,1092014** || ) which is a response Time in second, to make a range aggregation on a visualization.

The idea would be to make a range from 0 to 2, like this :  
\<0.3s  
0.3-0.6s  
0-6-1s  
1-2s  
\>2s

I was trying to do it with the JSON Input part, but I can't understand how to do it (and is it even possible ?)

Any idea if I can achieve this ?

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [June 12, 2019, 1:58pm UTC](https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190/2 "2019-06-12T13:58:07Z")

</div>

Range aggregation can only be applied to fields that are [mapped](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) as numbers.

You will need to extract the response time into its own field during indexing. Then you can use the range aggregation like the below example.

![29%20AM](https://us1.discourse-cdn.com/elastic/original/3X/6/6/665bfbe014c8ba1acfe791091bdb17618c3f4fa2.png)

---

<div class="post-metadata">

**Author:** ![lobotomeh](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@lobotomeh](https://discuss.elastic.co/u/lobotomeh)\
**Post date:** [June 12, 2019, 3:14pm UTC](https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190/3 "2019-06-12T15:14:48Z")

</div>

Hello Nathan, thanks for your reply.  
Unfortunately, i can't change the mapping either, so I can't add another field in the mapping of my index.

---

<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 10, 2019, 3:14pm UTC](https://discuss.elastic.co/t/using-json-input-in-a-vizualisation-to-create-my-own-range-aggregation/185190/4 "2019-07-10T15:14:50Z")

</div>

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