# MUTIPULE VALUES SEARCH

**URL:** <https://discuss.elastic.co/t/mutipule-values-search/311422>\
**Category:** Elasticsearch\
**Created:** [August 4, 2022, 1:08pm UTC](https://discuss.elastic.co/t/mutipule-values-search/311422 "2022-08-04T13:08:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanker241](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@shanker241](https://discuss.elastic.co/u/shanker241)\
**Post date:** [August 4, 2022, 1:08pm UTC](https://discuss.elastic.co/t/mutipule-values-search/311422/1 "2022-08-04T13:08:11Z")

</div>

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);  
});  
}  
})  
});  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 1, 2022, 1:09pm UTC](https://discuss.elastic.co/t/mutipule-values-search/311422/2 "2022-09-01T13:09:02Z")

</div>

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