Elasticsearch Integration Menu will allow entering a non-URL pattern in the URL field which will cause elusive errors during indexing
Description Elasticsearch Integration menu will allow users to enter a non-URL pattern in the URL field (like a simple IP) which will cause elusive errors during indexing. Although there is a "The URL to use for connecting to Elasticsearch. Use a comma-separated list to support clustering (e.g., "http://localhost:9200, http://localhost:9201")" message that should point the user in the right direction,
Solution: I believe there should be some kind of pattern validation for the URL text field in order to avoid the behaviour we've been seeing in support tickets.
What does success look like: Whenever someone inserts the wrong URL pattern in the URL text field they will not be allowed to save the Elasticsearch Integration settings and be given a suggestive error message.
Just in case other run into this I'll briefly describe the error:
The resulting error will manifest during indexing in Sidekiq with the message:
health check timeout: no Elasticsearch node available
see below:
There are no clue in the Elasticsearch log as to what could be wrong, since this is an issue on the Elastic client.
Sidekiq logs are showing the error but nothing else that would pinpoint where it is coming from.
Reason for issue:
Since we are using olivere/elastic.v5 in our code taking a look at this commit from its code shows us that we definitely need to use "http://" or "https://" (proper URL formatting).
Also Olivere/elastic connection issues page mentions in its last paragraph:
If you've turned sniffing off and you still can't connect to Elasticsearch, verify that you have http://
as part of your URL. Using something like localhost:9200 won't work, you need http://localhost:9200.
Solution for issue:
Change the value in the URL text field to include the http://
or https://
prefix (e.g., "from <IP>:9200
to http(s)://<IP>:9200
)