は以下を使用しますが動作しないことにより、20以上である:elasticsearchクエリ値の長さを持つテキストフィールド20以上の
GET /groups/_search
{
"query": {
"bool" : {
"must" : {
"script" : {
"script" : "_source.name.values.length() > 20"
}
}
}
}
}
エラーMSG次のとおりです。
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"_source.name.values.lengt ...",
"^---- HERE"
],
"script": "_source.name.values.length() > 5",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "groups",
"node": "exBbDVGeToSDRzLLmOh8-g",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: {\n \"bool\" : {\n \"must\" : [\n {\n \"script\" : {\n \"script\" : {\n \"inline\" : \"_source.name.values.length() > 5\",\n \"lang\" : \"painless\"\n },\n \"boost\" : 1.0\n }\n }\n ],\n \"disable_coord\" : false,\n \"adjust_pure_negative\" : true,\n \"boost\" : 1.0\n }\n}",
"index_uuid": "_VH1OfpdRhmd_UPV7uTNMg",
"index": "groups",
"caused_by": {
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"_source.name.values.lengt ...",
"^---- HERE"
],
"script": "_source.name.values.length() > ",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Variable [_source] is not defined."
}
}
}
}
]
},
"status": 400
}
私はそれを修正するべきか全く分からない...
はFYI:ESのバージョンは5.4.0私は関連の次の問題を知らない: 無痛script_fieldsは、あなたが使用することができます#20068 https://github.com/elastic/elasticsearch/issues/20068
あなたが代わりに '' _source'のctx._source'を試したことがありますか? – Val
ctx._sourceは私にとっては機能しません。 –
GET/china_groups/_search { "クエリ":{ "ブール":{ "必須":{ "スクリプト":{ "スクリプト":「DOC [ '名前'] values.size() > 5 " }} }} } これはあなたの' name'のフィールド内のトークンの数だけフィールド全体の長さを測定しません –