We have been using elastic node js client version 8.1.0 and updated to @elastic/Elasticsearch@8.2.0.
Suddently our msearch query stopped working with
ResponseError: illegal_argument_exception: [illegal_argument_exception] Reason: The msearch request must be terminated by a newline [ ]
at SniffingTransport.request
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Client.MsearchApi [as msearch] (xxx/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js:51:12)
Our syntax didn't change and I haven't found that ES would change syntax.
I am auto-generating all msearch queries with
requestList.push(
{
index: requests[j].index //index name as string
},
requests[j].query //predefine json templates {query: {bool: xxx}}
);
and than putting it into msearch
const response = await client.msearch({
searches: requestList
})
I tried to stringify and add \n at the end of body (or after index) but didn't work. Any idea what to do?