0
down vote
favorite
I have an index with a nested object. Mapping is like -
{
"mappings": {
"my_type": {
"properties": {
"group": {"type": "string"},
"users": {
"type": "nested",
"properties": {
"first": {"type": "string"},
"last": {"type": "string"}
}
}
}
}
}
}
I need to find all documents which have no 'users'. I can see how to find only document which have users -
GET /my_index/my_type/_search
{
"query": {
"nested": {
"path": "users",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "users"
}
}
]
}
}
}
}
}
but I don't know how to do the reverse. Any pointers?