# How to introduce variable in script field

**URL:** <https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375>\
**Category:** Kibana\
**Created:** [January 9, 2020, 8:48am UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375 "2020-01-09T08:48:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ravin\_Nadar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravin_nadar/32/60538_2.png) [@Ravin\_Nadar](https://discuss.elastic.co/u/Ravin_Nadar)\
**Post date:** [January 9, 2020, 8:48am UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/1 "2020-01-09T08:48:48Z")

</div>

i want to add filter in the visualization for expected result let say:  
int variable !=270 i want to store this much in my query. what should i do.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [January 9, 2020, 8:55pm UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/2 "2020-01-09T20:55:30Z")

</div>

Hi, what kind of visualization are you trying to make?

Is `270` one of the values that could exists for a field? What is the name of the field?

---

<div class="post-metadata">

**Author:** ![Ravin\_Nadar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravin_nadar/32/60538_2.png) [@Ravin\_Nadar](https://discuss.elastic.co/u/Ravin_Nadar)\
**Post date:** [January 10, 2020, 3:30am UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/3 "2020-01-10T03:30:37Z")

</div>

Thank you for your quick reply,  
270 is the value i got it from metric count of Hits of particular document.  
The visualization part is done, but i want to filter if the value of the document is 270 it should not know in my report but if something else value i got i need to show in the visualization

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [January 10, 2020, 10:24pm UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/4 "2020-01-10T22:24:33Z")

</div>

Sorry, I just don't have enough information about what kind of data you have and what you are trying to get done in a visualization.

---

<div class="post-metadata">

**Author:** ![Ravin\_Nadar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ravin_nadar/32/60538_2.png) [@Ravin\_Nadar](https://discuss.elastic.co/u/Ravin_Nadar)\
**Post date:** [January 31, 2020, 10:08am UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/5 "2020-01-31T10:08:27Z")

</div>

Thank you for your quick response. above query has fixed

---

<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:** [February 28, 2020, 10:08am UTC](https://discuss.elastic.co/t/how-to-introduce-variable-in-script-field/214375/6 "2020-02-28T10:08:33Z")

</div>

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