MUTIPULE VALUES SEARCH

HI ALL,

I Unable to search with mutipule values Please find the follwoing code its not working .

function getRiskRegister(monthYear) {
const client = new elasticsearch.Client({
host: elasticHost
});
monthYear = 'March2022,April2022,May2022,June2022,July2022';
monthYear = monthYear.replace(/[,]/g, ' AND ');
return new Promise((resolve, reject) => {
client.ping({
requestTimeout: 30000,
}, (err) => {
if(err) resolve({error: err});
else {
client.search({
index: 'itops_riskmanagement_riskregister',
type: 'itops_riskmanagement_riskregister',
body: {
"query": {
"match": {
"MonthYear": monthYear
}
},
"size": 1,
"sort": [
{
"updatedOn": {
"order": "desc"
}
}
]
}
}).then(function (resp) {
var data = {};
if (resp.hits.hits.length > 0) {
data = resp.hits.hits[0]._source;
} else if (resp.hasOwnProperty("error")) {
data = resp;
}
resolve(data);
});
}
})
});
}

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