1

return キーワードについて説明している関連ドキュメントが見つかりません。これはどこに文書化されていますか?

次のクエリを実行しています

POST /myindex/mytype/FwOaGmQBdhLB1nuQhK1Q/_update
{
  "script": {
    "source": """
      if (ctx._source.owner._id.equals(params.signedInUserId)){
        for (int i = 0; i < ctx._source.managers.length; i++) {
          if (ctx._source.managers[i].email.equals(params.managerEmail)) {
            ctx._source.managers.remove(i);
            return;
          }
        }
      }
      ctx.op = 'noop';
    """,
    "lang": "painless",
    "params": {
      "signedInUserId": "auth0|5a78c1ccebf64a46ecdd0d9c",
      "managerEmail": "d@d.com"
    }
  },
  "_source": true
}

しかし、私はエラーが発生しています

"type": "illegal_argument_exception",
"reason": "failed to execute script",
"caused_by": {
  "type": "script_exception",
  "reason": "compile error",
  "script_stack": [
    "... ve(i);\n            return;\n          }\n        }\n  ...",
    "                             ^---- HERE"
  ],
  "script": <the script here>,
  "lang": "painless",
  "caused_by": {
    "type": "illegal_argument_exception",
    "reason": "invalid sequence of tokens near [';'].",
    "caused_by": {
      "type": "no_viable_alt_exception",
      "reason": null
    }
  }

return キーワードを削除すると、スクリプトは実行されますが、期待どおりに動作しません。ブール値を使用して電子メールの削除を追跡することで動作を修正できますが、なぜ早期に復帰できないのですか?

4

1 に答える 1