TIM*_*MEX 3 lucene elasticsearch
以前,我有这个:
{
query: {
function_score: {
filter: {
and: [
{
term: {
'currency': 'usd',
'_cache': false
}
}
]
},
script_score: {
"script": "_score * doc['random_score'].value"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
非常基本,我只是按货币过滤并按分数排序.
但自从我升级后,我无法获得任何简单的自定义分数查询.
我试图用这个例子来简化它:
{
query: {
function_score: {
script_score: {
"script": "_score * doc['random_score'].value"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到的错误如下:
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[PxzZtO8FQviuhxS-3EJFwA][listings][3]:
SearchParseException[[listings][3]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['random_score'].value"
}
}
}
}
]]];
nested: QueryParsingException[[listings] script_score the script could not be loaded];
nested: ScriptException[dynamic scripting for [mvel] disabled]; }{[PxzZtO8FQviuhxS-3EJFwA][listings][4]:
SearchParseException[[listings][4]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['random_score'].value"
}
}
}
}
]]];
nested: QueryParsingException[[listings] script_score the script could not be loaded];
nested: ScriptException[dynamic scripting for [mvel] disabled]; }{[PxzZtO8FQviuhxS-3EJFwA][listings][0]:
SearchParseException[[listings][0]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['random_score'].value"
}
}
}
}
]]];
nested: QueryParsingException[[listings] script_score the script could not be loaded];
nested: ScriptException[dynamic scripting for [mvel] disabled]; }{[PxzZtO8FQviuhxS-3EJFwA][listings][1]:
SearchParseException[[listings][1]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['random_score'].value"
}
}
}
}
]]];
nested: QueryParsingException[[listings] script_score the script could not be loaded];
nested: ScriptException[dynamic scripting for [mvel] disabled]; }{[PxzZtO8FQviuhxS-3EJFwA][listings][2]:
SearchParseException[[listings][2]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"query": {
"function_score": {
"script_score": {
"script": "_score * doc['random_score'].value"
}
}
}
}
]]];
nested: QueryParsingException[[listings] script_score the script could not be loaded];
nested: ScriptException[dynamic scripting for [mvel] disabled]; }]",
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
像这样非常简单的东西,有效:
{
query: {
match_all: {}
}
}
Run Code Online (Sandbox Code Playgroud)
pro*_*mer 12
在以前的版本中,mvel是elasticsearch中的脚本,现在已经折旧了.
这是一个问题.https://github.com/elasticsearch/elasticsearch/issues/7029
实际问题是1.3.x中不支持mvel的动态脚本,但它也是1.3.x中的默认语言,将在1.4.x中更改,因此你必须包含lang参数,并赋值为,(lang =常规)
{
query:{
function_score:{
script_score : {
"script" : "_score * doc['random_score'].value",
"lang":"groovy"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!!谢谢
| 归档时间: |
|
| 查看次数: |
5096 次 |
| 最近记录: |