简体   繁体   中英

ElasticSearch filter query for having null value

I want to filter data from elasic search document like documents which is having blank list. HOw can i achieve that. Suppose i want this results.

1) { name:'vipul', gender:[] }

this is having blank list

You can combine a bool query with a exists query like so:

"bool": {
    "must_not": [
        {
            "exists": {
                "field": "gender"
            }
        }
    ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM