# JSON Input - Count strings (Metric visualization)

**URL:** <https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492>\
**Category:** Kibana\
**Created:** [October 7, 2016, 1:31pm UTC](https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492 "2016-10-07T13:31:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@Roberto\_Iglesias](https://discuss.elastic.co/u/Roberto_Iglesias)\
**Post date:** [October 7, 2016, 1:31pm UTC](https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492/1 "2016-10-07T13:31:26Z")

</div>

Hi and thanks for reading.  
I want to count how many times repeats a field.  
I have one field _auth\_failure_ and i want to count how many times it appears in logs. The field's content is always the same.  
Thanks!

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [October 7, 2016, 11:24pm UTC](https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492/2 "2016-10-07T23:24:34Z")

</div>

Hi Roberto,

Do you mean how many docs contain a term? Or how many times a term appears in each doc?

For how many docs contain a term, here I searched for a string `cron` on the Discover tab and it shows me `30 hits` at the top and highlights the search term in the doc \_source?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/dcad9cfd95748f64339ac23930ff2692a3516358.png)

Or in a Data Table visualization where I just searched for `cron` again. I'm not sure why I get 32 hits here instead of 30, but you get the idea.

 ![](https://us1.discourse-cdn.com/elastic/original/2X/e/e0ce3a730db07dfef3e024b182db5694af052fb8.png)

If you were asking about counting the number of times a term appears in each doc, that might be a bit harder...

Thanks,  
Lee

---

<div class="post-metadata">

**Author:** ![Roberto\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@Roberto\_Iglesias](https://discuss.elastic.co/u/Roberto_Iglesias)\
**Post date:** [October 12, 2016, 6:42pm UTC](https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492/3 "2016-10-12T18:42:09Z")

</div>

Hi, LeeDr and thanks so much for reply.  
Sorry for taking so long to answer. In this case, i want to count how many times a field takes a specific value. For example, the field _smtp\_status_ contains the value _sent_. This way i could count the sent e-mails in my server.  
I solved it by putting "_smtp\_status:sent_" in the search box.  
Thanks again for reply.

---

<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 6, 2017, 1:36pm UTC](https://discuss.elastic.co/t/json-input-count-strings-metric-visualization/62492/4 "2017-07-06T13:36:59Z")

</div>


