Hi, I am working with elasticsearch application for one of my application. My application need is below-
I have mulitple filters like location, type, qualification etc.. i have created query for this in which i am passing these filter values. so if location filter is not selected its value will be null and similar to others. therefoere, when i am applying these filters all together using terms query filter, it is giving me no result and this is because value of one or filter is going as null because those are not selected. i want that if any filter value is null or not selected i don't want to apply that filter so how can i achieve this in a common query. don't we have any such thing in filter query if filter value coming as null then filter should be run-
{
"query": {
"bool": {
"must": [
{
"match_all": {}
}
],
"filter": [
{
"terms": {
"preferredLocation.city": [
"delhi"
]
}
},
{
"terms": {
"qualificationRequired": [
""
]
}
},
{
"term": {
"jobType": ""
}
},
{
"term": {
"deliveryMedium": ""
}
}
]
}
}
}