How to search by an specific value or where field does not exists in Elasticsearch with and condition

How to search by a specific value or where the field does not exist in Elasticsearch with and condition
below is the query I'm trying
{
"query":{
"bool":{
"should":[
{
"query_string":{
"query":"( isStart:false) AND (isStop:false)"
}
},
{
"exists":{
"field":"isStart"
}
},
{
"exists":{
"field":"isStop"
}
}
]
}
}
}

I want to query ((isStart: false or exists field isStart) AND (isStop: false or exists field isStop))

how can I get this done

You probably need something like:

bool
  must [
    { bool -> should [  isStart: false or exists field isStart ] },
    { bool -> should [ isStop: false or exists field isStop ] }
  ]
2 Likes

@dadoonet, Thanks

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