# Timeout issue when using inference

**URL:** <https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188>\
**Category:** Elastic Search\
**Created:** [December 19, 2024, 2:28am UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188 "2024-12-19T02:28:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostinroom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lostinroom/32/138650_2.png) [@lostinroom](https://discuss.elastic.co/u/lostinroom)\
**Post date:** [December 19, 2024, 2:28am UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188/1 "2024-12-19T02:28:25Z")

</div>

Hi,  
I am following [Tutorial: semantic search with the inference API | Elasticsearch Guide [8.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-search-inference.html) page to setup semantic search.  
My setup is using Elasticsearch v8.16.1 and all-mpnet-base-v2 model from Hugging Face.  
The issue is when I search ([Tutorial: semantic search with the inference API | Elasticsearch Guide [8.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-search-inference.html#infer-semantic-search)), it throws me this error.  
{"took":10001,"responses":[{"error":{"root\_cause":[{"type":"status\_exception","reason":"timeout [10s] waiting for inference result"}],"type":"status\_exception","reason":"timeout [10s] waiting for inference result"},"status":408}]}

If I change the model to all-MiniLM-L6-v2, I don't have timeout issue.  
I cannot find a way to increase the timeout.  
Can show me how to change timeout settings?

Thanks

---

<div class="post-metadata">

**Author:** ![dkyle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkyle/32/59114_2.png) [@dkyle](https://discuss.elastic.co/u/dkyle)\
**Post date:** [December 19, 2024, 1:49pm UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188/2 "2024-12-19T13:49:29Z")

</div>

Hi @lostinroom

There isn't a way to adjust the 10 second timeout during search, the problem is tracked in this issue [[ML] Associate text\_expansion subsearch with parent search request · Issue #107077 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/107077)

10 seconds is a long time, the timeout is probably occurring because something else has gone wrong with the model deployment. I'm not sure increasing the timeout will help in this case.

Do you see any errors in the Elasticsearch logs relating to the `all-mpnet-base-v2` model. Can you share the logs please

---

<div class="post-metadata">

**Author:** ![lostinroom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lostinroom/32/138650_2.png) [@lostinroom](https://discuss.elastic.co/u/lostinroom)\
**Post date:** [December 20, 2024, 3:12am UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188/3 "2024-12-20T03:12:47Z")

</div>

Hi David,  
Thanks for quick response.  
After further investigation, it seems happened when reindexing not completed.  
So when reindex runs on background, I try to query dest index and it is timeout after 10s.  
Is it expected behavior?

Does it mean say reindex is completed and I query it while I am inserting new record to the index, it will be timeout as well? Cannot query during inserting?

Thanks

---

<div class="post-metadata">

**Author:** ![dkyle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkyle/32/59114_2.png) [@dkyle](https://discuss.elastic.co/u/dkyle)\
**Post date:** [December 23, 2024, 11:25am UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188/4 "2024-12-23T11:25:31Z")

</div>

Take a look a the Trained Models UI in Kibana, its displays a number of stats that will be helpful for you to understand what is going on. Particularly the **inference count** field which you will see increasing as documents are ingested. Average inference time is another useful stat as it will help you understand the throughput.

When inserting records and querying at the same time the query requests have a higher priority and will execute before the reindex requests, (see [Deploy the model in your cluster | Machine Learning in the Elastic Stack [master] | Elastic](https://www.elastic.co/guide/en/machine-learning/master/ml-nlp-deploy-model.html#infer-request-queues)). If you are still getting timeouts consider creating two model deployments one for ingest and another for search. That will ensure your search requests are not affected by ingest work

---

<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 20, 2025, 11:26am UTC](https://discuss.elastic.co/t/timeout-issue-when-using-inference/372188/5 "2025-01-20T11:26:32Z")

</div>

Closed on January 20, 2025, 11:26am UTC

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