How to query for null values?

I have some job data I’m storing in elasticsearch, lets say:
name : (optional)
status : [running/waiting]
@timestamp : …

I can plot a count of all running jobs with the query “status:running”, I can plot a count of all running jobs which have a name using “status:running and name:*”. How do I plot a count of all running jobs with no given name?

Think you can combine MustNot and Exists:

GET /_search
    "query": {
        "bool": {
            "must_not": {
                "exists": {
                    "field": "name"

Hi @daniellee,

How could I do that in Grafana? I mean, how can we apply mustnot and exists in grafana? In my case I’m trying not to show null values in the Graph panel, so I’d like to use exists.

Good question. Hard to remember the details 5 months later but maybe with these lucene extensions:

_exists_ did the trick, thanks :slight_smile:

1 Like


We want similar filter in Grafana .

We have below reference field in Grafana with value.


Can you explain how exists works in Lucene syntax?

Thanks & Regards,

Hi i tried implementing it for one field Request.CustomerId: null but data is not coming. i have tried changing the panel type also.

Can you please help? Although data is coming in full logs but creating panel on above query showing no data.