• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Elasticsearch error

AndyB

Well-known member
#1
Elasticsearch has been working fine for several days since it was installed. Last night I ran the Optimize in ES. This morning ES fails to work and I get a "No results found." when I try to search for anything.

On the server I can stop and start ES and all indications is that it's running on the server. I see the following errors in my ACP Server Error Log.

Code:
XenForo_Exception: Elasticsearch error: SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[_na_][xenforo113][2]: No active shards}{[_na_][xenforo113][3]: No active shards}{[_na_][xenforo113][0]: No active shards}{[_na_][xenforo113][1]: No active shards}{[_na_][xenforo113][4]: No active shards}] - library/XenES/Search/SourceHandler/ElasticSearch.php:713
Generated By: Unknown Account, 25 minutes ago
Code:
XenForo_Exception: Elasticsearch error: IndexMissingException[[xenforo113] missing] - library/XenES/Search/SourceHandler/ElasticSearch.php:713
Generated By: [URL='http://www.myforum.com/forums/admin.php?users/1/']Andy[/URL], Monday at 7:15 AM
 

Mike

XenForo developer
Staff member
#2
The recent error is essentially saying that ES isn't running. You may need to restart the service, possibly checking into the logs to figure out why there aren't any shards available.

The first error is what happens if someone tries to search after you've enabled ES in XF but didn't rebuild the search index (or optimize the mappings).
 

AndyB

Well-known member
#3
Hi Mike,

I got it working. Here are my observations.

Last night when the Elasticsearch Setup page showed Optimize I clicked it, I suspect that messed up the index. This morning (after noticing ES wasn't working) I looked at the Elasticsearch Setup page, I clicked the Delete Index and from what I can tell nothing happened. What fixed the problem was to go to the Rebuild Caches screen and doing a Rebuild Search Index.

It would be great if the Elasticsearch Setup page would provide an indication if a Search Index existed. So after you delete the Search Index it would show there isn't one and explain that you need to go to the Rebuild Caches page and rebuild your search index cache.
 

Attachments

graham_w

Active member
#6
I can't remember if there was any message, I do recall that it appeared to do nothing.
Ok - there was a post in another thread saying that when you click optimize it should force you to rebuild as it removes all of the old data. So what you saw was by design.

Question regarding upgrade of search

"A rebuild is not required, but to get the benefits, you will need to. But to get the benefits, you need to click "optimize" on the ES setup page, which would then force you to reindex as it would remove all of the old data"
 

AndyB

Well-known member
#7
Thanks Graham. Yes that's the thread that triggered me to try and optimize. When we optimize a MySQL table it doesn't require rebuilding the index and that's why I thought it would be similar with ES. Clicking Optimize in ES should trigger the index rebuild.