Exception in thread : All hosts are unreachable

Hi,

I am intermittently getting the error while searching the index:
Exception in thread “main” com.algolia.search.exceptions.AlgoliaRetryException: All hosts are unreachable

SearchResult<?> result = index.search(query);

After sometime it works fine without any code change. Can anyone please let me know what could be the issue?

Thanks and regards

Hello,

Is there any update on the above mentioned issue I am facing?

Hi @indranil.basu,

You will generally encounter this error when the credentials you are using i.e Application ID and the API key are wrong.

Hope this helps!

Harsh

Hi Harsh,

The same credentials work most of the times, but there are periods when it does not. The same program runs fine most of the time, however sometimes it just fails as mentioned in the ticket.

The issue is intermittent, but when it does it leads to bad customer experience.

Thanks and regards

Hi @indranil.basu ,

As you have mentioned that the error is showing up intermittently, it maybe that your connection is getting timed out.

As such, could you try increasing the timeouts as described by Algolia below and see if the problem still persists.

The error message you mentioned, “Exception in thread ‘main’ com.algolia.search.exceptions.AlgoliaRetryException: All hosts are unreachable,” indicates that the Algolia search library is unable to establish a connection to the Algolia search servers. This can happen due to various reasons, such as network issues, server downtime, or problems with your internet connection. Visit it

Occasionally, when performing a search using the Algolia index, I’m faced with the error
What’s intriguing is that after a while, without any changes to my code, the search functionality starts working seamlessly again. I’m scratching my head to figure out what might be causing this intermittent problem. Has anyone else experienced a similar issue, and if so, what steps did you take to troubleshoot and resolve it?
Visit Heated hunting pants