# Can someone helps me with this Json input!

**URL:** <https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122>\
**Category:** Kibana\
**Created:** [April 2, 2021, 4:57pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122 "2021-04-02T16:57:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skander\_Harrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skander_harrabi/32/78403_2.png) [@Skander\_Harrabi](https://discuss.elastic.co/u/Skander_Harrabi)\
**Post date:** [April 2, 2021, 4:57pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/1 "2021-04-02T16:57:25Z")

</div>

Hello there,

So i created an alias based on two indexes,  
and am creating a visualization with that alias that have a metric (count),  
what i want do is to make that metric works with documents from only one of indexes that i specify  
is it possible to do with JSON input ? if no, there is any alternative to solve this problem

thanks in advance

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [April 5, 2021, 4:17pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/2 "2021-04-05T16:17:28Z")

</div>

Hello @Skander_Harrabi

This might be a good candidate for using scripted fields - [Scripted fields | Kibana Guide [7.12] | Elastic](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

You could look at the value of the \_index field and conditionally return a value based on it.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![Skander\_Harrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skander_harrabi/32/78403_2.png) [@Skander\_Harrabi](https://discuss.elastic.co/u/Skander_Harrabi)\
**Post date:** [April 5, 2021, 8:15pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/3 "2021-04-05T20:15:53Z")

</div>

Hello mattkime ,  
Thanks for your time , but i think i cant use the scripted fields on count metric,  
if i can please show me how if not , do you suggest another method ?

thanks again for advance 🙂

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [April 5, 2021, 9:39pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/4 "2021-04-05T21:39:58Z")

</div>

@Skander_Harrabi

You could use the sum metric instead.

Thanks,  
Matt

---

<div class="post-metadata">

**Author:** ![Skander\_Harrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skander_harrabi/32/78403_2.png) [@Skander\_Harrabi](https://discuss.elastic.co/u/Skander_Harrabi)\
**Post date:** [April 5, 2021, 11:15pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/5 "2021-04-05T23:15:28Z")

</div>

yes man thanks alot 🙂

---

<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:** [May 3, 2021, 11:16pm UTC](https://discuss.elastic.co/t/can-someone-helps-me-with-this-json-input/269122/6 "2021-05-03T23:16:23Z")

</div>

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