Script_fields in MultiSearchRequest

Can I use script_fields from one query in another query script when I create multisearch request?
I have this error, can anyone help me?
This my request in Postman:

    {"index" : "core_event_usvc_provided"}
    {"query" : {"match_all" : {}},"script_fields" : {"dataModelJoin": {"script": {"lang": "painless","source": "doc['code.keyword'].value "}}} , "from": 0, "size": 1}
    {"index" : "usvctype"}
    {"query": {"match": {"code.keyword": dataModelJoin}}}

And I have this error:

{
    "error": {
        "root_cause": [
            {
                "type": "json_parse_exception",
                "reason": "Unrecognized token 'dataModelJoin': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@5198e63b; line: 1, column: 52]"
            }
        ],
        "type": "json_parse_exception",
        "reason": "Unrecognized token 'dataModelJoin': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@5198e63b; line: 1, column: 52]"
    },
    "status": 400
}

When I don't use scrip_field in second query all good works

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.