elastic exists query for nested documents

The example mentioned on the Elasticsearch blog refers to string and array of string types, not for nested types.

The following query should work for you:

{
    "query": {
        "nested": {
            "path": "users",
            "query": {
                "bool": {
                    "must": [
                        {
                            "exists": {
                                "field": "users"
                            }
                        }
                    ]
                }
            }
        }
    }
}

Also, you can refer to this issue for more info, which discusses this usage pattern.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)