Elasticsearch Search Down - SearchPhaseExecutionException

时间:2014-05-27 04:59:48

标签: elasticsearch pyelasticsearch

我的服务器运行正常,直到我开始收到搜索查询的错误:

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]; }]'
)

我不明白改变了什么。 使用pyelasticsearch,这是被推送的查询

    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"]}
            }
        }
    }

修改

启用动态脚本及其工作。为什么它提前工作,突然停止了。 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html

1 个答案:

答案 0 :(得分:0)

如果我指的是您的错误日志,那么解析您的elasticsearch查询dsl中的错误。

如下: -

"script": "_score * (1.000008**(doc[\'articleid\'].value*50000.0/100000.0))"

应该是:

"script": "_score * (1.000008**(doc['articleid'].value*50000.0/100000.0))"

从查询中删除额外的反斜杠。