# Discover view is very slow

**URL:** <https://discuss.elastic.co/t/discover-view-is-very-slow/91810>\
**Category:** Kibana\
**Created:** [July 4, 2017, 7:33pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810 "2017-07-04T19:33:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![foxylion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/foxylion/32/19764_2.png) [@foxylion](https://discuss.elastic.co/u/foxylion)\
**Post date:** [July 4, 2017, 7:33pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/1 "2017-07-04T19:33:12Z")

</div>

Hi,  
we are using Kibana to browse our logs generated by filebeat and logstash.

Currently we have ~120.000.000 log records, indexed with daily indices. Each index has replica=2 and shards=1. An index is about 300-500 mb in size and contains ~1.000.000 records.

When opening the discover view of kibana it takes about 20 seconds to complete the \_msearch HTTP request.

When executing this query manually I can verify that the time is spent at waiting for elasticsearch to return the result of the request.

Sample request:  
{"index":["logstash-2017.07.04"],"ignore\_unavailable":true,"preference":1499194753566}  
{"size":5000,"sort":[{"@timestamp":{"order":"desc","unmapped\_type":"boolean"}}],"highlight":{"pre\_tags":["@kibana-highlighted-field@"],"post\_tags":["@/kibana-highlighted-field@"],"fields":{"_":{}},"require\_field\_match":false,"fragment\_size":2147483647},"\_source":{"excludes":[]},"aggs":{"2":{"date\_histogram":{"field":"@timestamp","interval":"30m","time\_zone":"Europe/Berlin","min\_doc\_count":1}}},"query":{"bool":{"must":[{"match\_all":{}},{"range":{"@timestamp":{"gte":1499108623749,"lte":1499195023750,"format":"epoch\_millis"}}}],"must\_not":[]}},"stored\_fields":["_"],"script\_fields":{},"docvalue\_fields":["@timestamp"]}

When removing the following part of the query the result is returned much faster.  
"aggs":{"2":{"date\_histogram":{"field":"@timestamp","interval":"30m","time\_zone":"Europe/Berlin","min\_doc\_count":1}}}

I suspect that this part generates the histogram above the results. Is there any possibility to speed this up?

What also improves the performance is to reduce the "size" part in the query to e.g. "500" (option discover:sampleSize). But this limits the discover view to only show the last x records. Kibana is already loading more records on demand (when scrolling to the end), but only up to discover:sampleSize records. So I would like to set this value to a high one (e.g. 5000). Is there any possibility to increase the value without reducing the query performance?

Thanks for your help!  
Jakob

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [July 5, 2017, 8:18am UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/2 "2017-07-05T08:18:07Z")

</div>

Hi @foxylion,

there are several aspects to this.

We are aware that the discover view performance is far from acceptable and improving that is on my personal todo list. Aside from the rendering performance your cluster might also lack the resources to efficiently aggregate across that many documents. The [query profiler](https://www.elastic.co/guide/en/x-pack/current/xpack-profiler.html) included in the free tier of x-pack can help with diagnosing such performance bottlenecks. In addition, the single shard setting might prevent your cluster from taking advantage of the parallelism afforded by having multiple nodes with multiple CPUs.

As for hiding the histogram in discover, it has been requested before and is tracked on [Github](https://github.com/elastic/kibana/issues/6164). Please feel free to add a comment describing your situation to the issue to improve our ability to assess its priority.

---

<div class="post-metadata">

**Author:** ![foxylion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/foxylion/32/19764_2.png) [@foxylion](https://discuss.elastic.co/u/foxylion)\
**Post date:** [July 5, 2017, 1:36pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/3 "2017-07-05T13:36:13Z")

</div>

Hi Felix,  
thanks for your reply. Is there an issue which tracks the performance improvements of the discover view? I would like to follow the progress, because that seems like the best solution.

Unless then I will try to increase the shards per index, maybe this will improve the overall query performance.

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [July 5, 2017, 2:05pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/4 "2017-07-05T14:05:50Z")

</div>

Here you go: [https://github.com/elastic/kibana/issues/12665](https://github.com/elastic/kibana/issues/12665)

Please don't hesitate to add comments describing your current situation and your requirements to that issue.

---

<div class="post-metadata">

**Author:** ![foxylion](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/foxylion/32/19764_2.png) [@foxylion](https://discuss.elastic.co/u/foxylion)\
**Post date:** [July 5, 2017, 6:21pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/5 "2017-07-05T18:21:45Z")

</div>

Thanks Felix,  
I commented on the issue. 🙂

---

<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:** [August 2, 2017, 6:28pm UTC](https://discuss.elastic.co/t/discover-view-is-very-slow/91810/6 "2017-08-02T18:28:19Z")

</div>

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