GET index1/_search
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "publish_details",
"query": {
"bool": {
"must_not": [
{
"exists": {
"field": "publish_details.environment"
}
}
]
}
}
}
}
]
}
}
}
Query2
GET index1/_search
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "publish_details",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "publish_details.environment"
}
}
]
}
}
}
}
]
}
}
}
Both gives the same result. I was expecting must exists and must_not exists to give mutually exclusive results but it is not.
Please let me know how both gives the same results? and clarify do i need to specify the field path in exists query? ie., publish_details.environment vs environement usage