0
{
    "query": {
        "match_all": {}
    },
    "script": {
        "source":"if(ctx._source.containsKey('priority')){if (ctx._source.priority != null && ctx._source.priority != 'null') { ctx._source.priority_filter  =  String.valueOf(ctx._source.priority) } else { ctx._source.priority_filter = ''}}",
        "lang": "painless"
        
    }
}

当我尝试运行上述脚本时出现以下错误,谁能告诉我哪里出错了,我的弹性搜索版本是v6.5.2

{
        "error": {
            "root_cause": [
                {
                    "type": "mapper_parsing_exception",
                    "reason": "Root mapping definition has unsupported parameters:  [query : {match_all={}}] [script : {source=if(ctx._source.containsKey('priority')){if (ctx._source.priority != null && ctx._source.priority != 'null') { ctx._source.priority_filter  =  String.valueOf(ctx._source.priority) } else { ctx._source.priority_filter = ''}}, lang=painless}]"
                }
            ],
            "type": "mapper_parsing_exception",
            "reason": "Root mapping definition has unsupported parameters:  [query : {match_all={}}] [script : {source=if(ctx._source.containsKey('priority')){if (ctx._source.priority != null && ctx._source.priority != 'null') { ctx._source.priority_filter  =  String.valueOf(ctx._source.priority) } else { ctx._source.priority_filter = ''}}, lang=painless}]"
        },
        "status": 400
    }
4

0 回答 0