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

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;

Mouth

Well-known member
#1
xfES v1.1.1
ElasticSearch v1.3.2

Have started getting the following error for all searches ...

Error Info
XenForo_Exception: Elasticsearch error: SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[yrrGWR-iT4eRlgIUwef1-g][netrider][0]: SearchParseException[[netrider][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"vfr800","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1411168431,"halflife":31536000},"lang":"groovy","script":"_score \/ pow(2.0F, min(10.0F * halflife, abs(now - doc['date'].value)) \/ halflife)"}}},"sort":[{"_score":"desc"},{"date":"desc"}],"size":250,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[netrider] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[yrrGWR-iT4eRlgIUwef1-g][netrider][2]: SearchParseException[[netrider][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"vfr800","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1411168431,"halflife":31536000},"lang":"groovy","script":"_score \/ pow(2.0F, min(10.0F * halflife, abs(now - doc['date'].value)) \/ halflife)"}}},"sort":[{"_score":"desc"},{"date":"desc"}],"size":250,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[netrider] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[yrrGWR-iT4eRlgIUwef1-g][netrider][1]: SearchParseException[[netrider][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"vfr800","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1411168431,"halflife":31536000},"lang":"groovy","script":"_score \/ pow(2.0F, min(10.0F * halflife, abs(now - doc['date'].value)) \/ halflife)"}}},"sort":[{"_score":"desc"},{"date":"desc"}],"size":250,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[netrider] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[yrrGWR-iT4eRlgIUwef1-g][netrider][4]: SearchParseException[[netrider][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"vfr800","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1411168431,"halflife":31536000},"lang":"groovy","script":"_score \/ pow(2.0F, min(10.0F * halflife, abs(now - doc['date'].value)) \/ halflife)"}}},"sort":[{"_score":"desc"},{"date":"desc"}],"size":250,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[netrider] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[yrrGWR-iT4eRlgIUwef1-g][netrider][3]: SearchParseException[[netrider][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"vfr800","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1411168431,"halflife":31536000},"lang":"groovy","script":"_score \/ pow(2.0F, min(10.0F * halflife, abs(now - doc['date'].value)) \/ halflife)"}}},"sort":[{"_score":"desc"},{"date":"desc"}],"size":250,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[netrider] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }] - library/XenES/Search/SourceHandler/ElasticSearch.php:845

Stack Trace
#0 library/XenES/Search/SourceHandler/ElasticSearch.php(305): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true)
#1 library/XenForo/Search/SourceHandler/Abstract.php(115): XenES_Search_SourceHandler_ElasticSearch->executeSearch('vfr800', false, Array, Array, false, '250')
#2 library/XenForo/Search/Searcher.php(79): XenForo_Search_SourceHandler_Abstract->searchGeneral('vfr800', Array, 'relevance', '250')
#3 library/XenForo/ControllerPublic/Search.php(235): XenForo_Search_Searcher->searchGeneral('vfr800', Array, 'relevance')
#4 library/Andy/SearchLog/ControllerPublic/Search.php(8): XenForo_ControllerPublic_Search->actionSearch()
#5 library/XenES/Proxy/ControllerSearch.php(30): Andy_SearchLog_ControllerPublic_Search->actionSearch()
#6 library/XenForo/FrontController.php(347): XenES_Proxy_ControllerSearch->actionSearch()
#7 library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
["url"] => string(36) "http://netrider.net.au/search/search"
["_GET"] => array(1) {
["/search/search"] => string(0) ""
}
["_POST"] => array(4) {
["keywords"] => string(6) "vfr800"
["users"] => string(0) ""
["date"] => string(0) ""
["_xfToken"] => string(8) "********"
}
}
ElasticSearch options ..
Screen Shot 2014-09-20 at 11.22.19.png

Search Options ...
Screen Shot 2014-09-20 at 11.22.48.png

I've just finished a full rebuild, but this didn't resolve it ...
Screen Shot 2014-09-20 at 11.24.45.png

Have also restarted ElasticSearch to check it is running properly ...
Code:
curl http://127.0.0.1:9200
{
  "status" : 200,
  "name" : "Master Mold",
  "version" : {
    "number" : "1.3.2",
    "build_hash" : "dee175dbe2f254f3f26992f5d7591939aaefd12f",
    "build_timestamp" : "2014-08-13T14:29:30Z",
    "build_snapshot" : false,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}
 

Mouth

Well-known member
#3
Thanks, I previously read those.
According to #3 since I have the dynamic search enabled then I don't need to have the _scripts/* copied over to /etc/elasticsearch/
I'll try turning it off though (and copying the files), and see how that goes.
 

Mouth

Well-known member
#4
Thanks, that fixed it.
I must have mis-understood - I read that the scripts weren't required if using dynamic.
Appears better that I have it off.
 

Mike

XenForo developer
Staff member
#5
The scripts aren't required if using dynamic scripting, but it does need to be enabled in your config. (Dynamic scripting with Groovy is supposed to be the default from my understanding.)

The relevant part of the exception was at the end:
ScriptException[dynamic scripting for [groovy] disabled]
 
M

Member 10517

Guest
#8
Doesn't work for me with elasticsearch version 1.4.3
Now I deactivated dynamic scripting in the config, but the other way is more secure.
 

Mike

XenForo developer
Staff member
#9
Are you sure you put the scripts in the correct place? If so, you will see log entries in Elasticsearch indicated that they were loaded. (Note that Elasticsearch polls for script changes, so you need to wait for the log entry indicating that they were loaded.)
 

Moshe1010

Well-known member
#10
The scripts aren't required if using dynamic scripting, but it does need to be enabled in your config. (Dynamic scripting with Groovy is supposed to be the default from my understanding.)

The relevant part of the exception was at the end:
I'm a litte bit confused. What would be "better", to enable dynamic scripting or using the included script?
 

Mike

XenForo developer
Staff member
#11
Dynamic scripting can be a security issue if your Elasticsearch server can be accessed by untrusted users (or is misconfigured so that can happen).

Non-dynamic scripting will likely be slightly (probably imperceptibly) faster due to pre-compiling rather than doing it with each search.
 

Mike

XenForo developer
Staff member
#17
You'd either need to enable dynamic scripting with groovy or switch to non-dynamic scripting (and ensure the scripts are stored in your Elasticsearch config).