My server was running fine until I start getting this error for search queries:
RequestError: TransportError(400, u'SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures
{[bgh1FwvvTmydjtDhY-reCA][article-index][3]:
SearchParseException[[article-index][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query": {"custom_score": {"query": {"query_string": {"query": "Arvi", "fields": ["text", "title^3", "domain"]}}, "script": "_score * (1.000008**(doc[\'articleid\'].value*50000.0/100000.0))"}}}]]]; nested: QueryParsingException[[article-index] [custom_score] the script could not be loaded]; nested: ScriptException[dynamic scripting disabled]; }
{[bgh1FwvvTmydjtDhY-reCA][article-index][4]: SearchParseException[[article-index][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query": {"custom_score": {"query": {"query_string": {"query": "Arvi", "fields": ["text", "title^3", "domain"]}}, "script": "_score * (1.000008**(doc[\'articleid\'].value*50000.0/100000.0))"}}}]]]; nested: QueryParsingException[[article-index] [custom_score] the script could not be loaded]; nested: ScriptException[dynamic scripting disabled]; }
{[bgh1FwvvTmydjtDhY-reCA][article-index][1]: SearchParseException[[article-index][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query": {"custom_score": {"query": {"query_string": {"query": "Arvi", "fields": ["text", "title^3", "domain"]}}, "script": "_score * (1.000008**(doc[\'articleid\'].value*50000.0/100000.0))"}}}]]]; nested: QueryParsingException[[article-index] [custom_score] the script could not be loaded]; nested: ScriptException[dynamic scripting disabled]; }
{[bgh1FwvvTmydjtDhY-reCA][article-index][2]: SearchParseException[[article-index][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"query": {"custom_score": {"query": {"query_string": {"query": "Arvi", "fields": ["text", "title^3", "domain"]}}, "script": "_score * (1.000008**(doc[\'articleid\'].value*50000.0/100000.0))"}}}]]]; nested: QueryParsingException[[article-index] [custom_score] the script could not be loaded]; nested: ScriptException[dynamic scripting disabled]; }]'
)
I do not understand what has been changed. Using pyelasticsearch, this is the query being pushed
bodyquery = {
"custom_score": {
"script" : "_score * ("+str(1.0+recency)+"**(doc['articleid'].value*50000.0/"+maxarticleid+"))",
"query": {
"query_string": {"query": keywordstr, "fields": ["text", "title^3", "domain"]}
}
}
}
EDIT:
Enabled dynaic scripting and its working. Why was it working earlier, and suddenly it stopped. http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html
If I am referring to you error log then parse error in your elasticsearch query dsl.
as below:-
Should be:
Remove extra backslashes from query.