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

Sudden enhanced search errors

Jake B.

Well-known member
#1
For quite some time now search has been working 100% fine, but in the past few hours we've gotten thousands of instances of the following error (one for every search made):

Code:
XenForo_Exception: Elasticsearch error: SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[3Q2lHXhmTWahqsMjDSl8QA][snip][0]: SearchParseException[[snip][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"charger","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1505417270,"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":600,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[snip] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[3Q2lHXhmTWahqsMjDSl8QA][snip][1]: SearchParseException[[snip][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"charger","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1505417270,"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":600,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[snip] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[3Q2lHXhmTWahqsMjDSl8QA][snip][2]: SearchParseException[[snip][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"charger","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1505417270,"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":600,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[snip] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[3Q2lHXhmTWahqsMjDSl8QA][snip][3]: SearchParseException[[snip][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"charger","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1505417270,"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":600,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[snip] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[3Q2lHXhmTWahqsMjDSl8QA][snip][4]: SearchParseException[[snip][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query":{"function_score":{"boost_mode":"replace","query":{"query_string":{"query":"charger","fields":["title^3","message"],"default_operator":"and"}},"script_score":{"params":{"now":1505417270,"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":600,"fields":["discussion_id","user","date"]}]]]; nested: QueryParsingException[[snip] script_score the script could not be loaded]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }] - library/XenES/Search/SourceHandler/ElasticSearch.php:845
Nothing has changed, ElasticSearch seems to be running fine
Code:
[root@db elasticsearch]# curl -XGET '172.16.1.1:9200'

{

  "status" : 200,
  "name" : "ElasticSearch",
  "cluster_name" : "xf-elasticsearch",
  "version" : {
    "number" : "1.5.2",
    "build_hash" : "62ff9868b4c8a0c45860bebb259e21980778ab1c",
    "build_timestamp" : "2015-04-27T09:21:06Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}


Screen Shot 2017-09-14 at 2.32.24 PM.png

Screen Shot 2017-09-14 at 2.34.18 PM.png

We do have @digitalpoint's search add-on installed as well, not sure if anyone has run into issues with that, or if it's at all related but I doubt it

Screen Shot 2017-09-14 at 2.34.12 PM.png

Any insight of course is greatly appreciated as I'm not all that familiar with ElasticSearch
 

Jake B.

Well-known member
#2
Quick update on this, disabled the "Enable recency weighted relevance searching with specified half-life (days):" option and search is now working at least, but (at least as far as I'm aware) this has been enabled for quite some time without issue, and the first instance of this error was about an hour and a half to 2 hours ago
 

Mike

XenForo developer
Staff member
#3
The error is:
ScriptException[dynamic scripting for [groovy] disabled]
So dynamic scripting has been disabled in Elasticsearch. That would need to either be enabled (ensure Elasticsearch is locked down) or you need to place one of the scripts shipped with XFES into ES's scripts directory and disable dynamic scripting within XF.

You may also want to look at Elasticsearch updates (it doesn't mean XFES2's requirements).