# Draw a colored circle

**URL:** <https://discuss.elastic.co/t/draw-a-colored-circle/216980>\
**Category:** Kibana\
**Created:** [January 29, 2020, 10:26am UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980 "2020-01-29T10:26:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mouloud\_CHIKHOUNE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mouloud_chikhoune/32/46957_2.png) [@Mouloud\_CHIKHOUNE](https://discuss.elastic.co/u/Mouloud_CHIKHOUNE)\
**Post date:** [January 29, 2020, 10:26am UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980/1 "2020-01-29T10:26:37Z")

</div>

Hi, I have the file log below and I want to draw a colored circle in function of the input : "header.message" (green for sucess and red for failure).  
PS: I want to do that just for the last document. thanks

 ![gdgh](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e26ad5f594eae23eab7345aba786102f99db69ba.png)  
 ![qsqqqq](https://us1.discourse-cdn.com/elastic/original/3X/1/7/17198499b60348cbd79e27cde80581f722bf18d3.png)

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [January 29, 2020, 7:48pm UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980/2 "2020-01-29T19:48:08Z")

</div>

There are a couple of ways to do this in Visualize using Gauge/Goal type visualizations. The gauge and goal visualizations expect numeric data, so first we would have to use a [scripted field](https://www.elastic.co/guide/en/kibana/7.5/scripted-fields.html) to turn the messages into numbers, something like 0 for failure and 1 for success. Then we can create a Goal visualization with a Top Hit metric on the scripted field we've created, and configure the ranges so that a 0 value will display a red circle and a 1 value will display a green circle. It would look something like this:

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

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

If you specifically need a filled in circle, you could do the same thing with TSVB's "Gauge" visualization which has a filled in circle as a display option.

I think you could also do this in Canvas easily without needing to create the scripted field first, but I am guessing you want to but this on a dashboard beside other basic visualizations.

---

<div class="post-metadata">

**Author:** ![Mouloud\_CHIKHOUNE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mouloud_chikhoune/32/46957_2.png) [@Mouloud\_CHIKHOUNE](https://discuss.elastic.co/u/Mouloud_CHIKHOUNE)\
**Post date:** [January 29, 2020, 8:35pm UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980/3 "2020-01-29T20:35:32Z")

</div>

Hi, I used scripted field to create a numeric field 'testField'. Here is the script :  
doc ['header.message'] == "failure" ? 0 : 1  
But I can't bring up the value 0 for failure and 1 for success. And load my documents  
Thank you for your help

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [January 31, 2020, 8:35pm UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980/4 "2020-01-31T20:35:32Z")

</div>

Most likely you need to use the `.keyword` version of your field in the script, e.g.

```auto
doc ['header.message.keyword'] == "failure" ? 0 : 1

```

If you click this link on the scripted field creation page you'll also be able to see any errors Elasticsearch is returning which will help you debug the issue:

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

---

<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, 8:40pm UTC](https://discuss.elastic.co/t/draw-a-colored-circle/216980/5 "2020-02-28T20:40:56Z")

</div>

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