# ML count aggregation, fields are not visible to create ml job

**URL:** <https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093>\
**Category:** Kibana\
**Tags:** elastic-stack-machine-learning\
**Created:** [December 26, 2018, 4:02am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093 "2018-12-26T04:02:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sripal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sripal/32/36704_2.png) [@Sripal](https://discuss.elastic.co/u/Sripal)\
**Post date:** [December 26, 2018, 4:02am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/1 "2018-12-26T04:02:28Z")

</div>

Hi all,

I am trying to create a simple ML job to forecast.

No fields are visible in count aggregation. I can able to do using other aggregation like mean and sum.  
But i want to use count as my aggregation. Could you anybody help me.

I have two number fields in my index 1. responsecode 2. response

Thanks in advance.  
Sripal

---

<div class="post-metadata">

**Author:** ![Sripal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sripal/32/36704_2.png) [@Sripal](https://discuss.elastic.co/u/Sripal)\
**Post date:** [December 26, 2018, 4:06am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/2 "2018-12-26T04:06:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [December 27, 2018, 1:10pm UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/3 "2018-12-27T13:10:15Z")

</div>

It is because `count` counts documents, not fields.

---

<div class="post-metadata">

**Author:** ![Sripal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sripal/32/36704_2.png) [@Sripal](https://discuss.elastic.co/u/Sripal)\
**Post date:** [December 28, 2018, 6:29am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/4 "2018-12-28T06:29:54Z")

</div>

Thanks @richcollier. How to count the numbers in ml job.  
Ex:  
I got 404 response code 100 times in past two days. How do i forecast in next 5 days how many times the 404 response code will occur.

Without using the count, how do I achieve the same?

could you please help me

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [December 28, 2018, 4:10pm UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/5 "2018-12-28T16:10:57Z")

</div>

1. Create a search that returns 404 response codes: (i.e. - `status:404`)

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

1. save this search

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

1. Create job from saved search

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

1. Select `count` aggregation and appropriate bucket\_span

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/5/7556b5ac1fd1f43e2bdc11a8f0df6c050a320fd4.png)

1. Run job as much historical data as possible, get results

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

1. Click forecast button and run your forecast

---

<div class="post-metadata">

**Author:** ![Sripal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sripal/32/36704_2.png) [@Sripal](https://discuss.elastic.co/u/Sripal)\
**Post date:** [December 31, 2018, 5:09am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/6 "2018-12-31T05:09:45Z")

</div>

Thank you very much @richcollier

😀

---

<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:** [January 28, 2019, 5:09am UTC](https://discuss.elastic.co/t/ml-count-aggregation-fields-are-not-visible-to-create-ml-job/162093/7 "2019-01-28T05:09:51Z")

</div>

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