# How can a document get take 38 seconds?

**URL:** <https://discuss.elastic.co/t/how-can-a-document-get-take-38-seconds/73331>\
**Category:** Elasticsearch\
**Created:** [January 31, 2017, 9:38am UTC](https://discuss.elastic.co/t/how-can-a-document-get-take-38-seconds/73331 "2017-01-31T09:38:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Attila\_Nagy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/attila_nagy/32/46906_2.png) [@Attila\_Nagy](https://discuss.elastic.co/u/Attila_Nagy)\
**Post date:** [January 31, 2017, 9:38am UTC](https://discuss.elastic.co/t/how-can-a-document-get-take-38-seconds/73331/1 "2017-01-31T09:38:06Z")

</div>

Hi,

We have an application which uses 5.1.2 java client with transport protocol and a 5.1.2 cluster. The app measures elastic response times and some get operations return in the order of tens of seconds.

An example shows 38036.18004 ms response time for this index for a simple document get:

```
curl -s 'http://localhost:9200/_cat/shards?v' | grep 'accounts_2 '
accounts_2 0 r STARTED 2366203 745.4mb 10.6.145.198 fe05
accounts_2 0 p STARTED 2366203 738.2mb 10.6.145.195 fe02
accounts_2 0 r STARTED 2366203 740.4mb 10.6.145.197 fe04

```

The segments look like this (the index was created in 2.4 and later upgraded to 5.1):

```
curl -s 'http://localhost:9200/_cat/segments?v' | egrep '^index|accounts_2 '

```

[http://pastebin.com/se7HwHud](http://pastebin.com/se7HwHud)

I wonder: how can a document get last 38 seconds? At that time, the cluster was green.  
There are other queries running while this happens and the statistical breakdown looks OK:

```
      N Min Max Median Avg Stddev
x 2574735 0.328462 38036.18 1.101684 8.7738861 126.71908

```

Meaning from nearly 2.6M doc gets the slowest was 38 seconds, but the median shows a healthy 1.1 ms, so there are only some (but a constant amount of) slow queries.

While running on ES2.4, there weren't any such slow queries. The average was nearly the same as the median.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 31, 2017, 9:43am UTC](https://discuss.elastic.co/t/how-can-a-document-get-take-38-seconds/73331/2 "2017-01-31T09:43:49Z")

</div>

This is the same as [How to find out why a document get is slow?](https://discuss.elastic.co/t/how-to-find-out-why-a-document-get-is-slow/73203), so feel free to add more to that thread if required, but creating more threads makes it harder to help 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 31, 2017, 9:44am UTC](https://discuss.elastic.co/t/how-can-a-document-get-take-38-seconds/73331/3 "2017-01-31T09:44:03Z")

</div>


