How to execute multiple search query in node.js using elastic search and promises?

Working Query:

POST /_msearch
    { "index": "INDEX_NAME_1", "type": "callStart" }
    { "query": { "match_all": {}}}
    { "index": "INDEX_NAME_2", "type": "callEnd" }
    { "query": { "match_all": {}}}

If I run the above query in kibana console i'm getting the response for both "callstart" and "callEnd".

Please find the below code that i have done in node js for single type "callEnd" and i'm getting the response back for the type of "callEnd". When i tried for multiple type(callStart & callEnd) i'm not able to fetch the data. can anyone please help me for fetching data with multiple types.

Node Js code :

return new Promise(function (resolve, reject) {
        elasticClient.search({
             index: '*:logstash-prod-*',
             type: 'callEnd',
             size: 10000,
             body: {
                 query: {

                     range: {
                         "@timestamp": {
                             "gte": startTime,
                             "lte": endTime
                         }
                     }
                 }
             },
         }, function (error, response, status) {
             if (error) {
                    reject(error);
             }
             else {
                     let elasticResponse=response.hits.hits;
                     resolve(response);
             }
         })
     });

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