How to filter Boolean field that have not set value?

For example, I have a field named ‘IsValid’ and its field type is Boolean
I would like to search for entities that contain that field.
In case: ‘IsValid’ is true or false. My filterSpec will look like:

"filterSpec": {
        "filters": [
            "DomainTest.IsValid:true"
        ]
    }

OR

"filterSpec": {
        "filters": [
            "DomainTest.IsValid:false"
        ]
    }

In case: ‘IsValid’ have not set a value. It might be a null value. Will my filterSpec look like?
I tried this filterSpec but it does not work:

"filterSpec": {
        "filters": [
            "DomainTest.IsValid:null"
        ]
    }

Hi @quynh-still-birch,

Only the fields that contain value are stored in the index therefore the filter you want to use will not work. Underlying search engines always expect value, therefore indexing null value is not an option for us. We would need to introduce special null value per supported data type which would bring a lot of complexity to the queries (i.e.: recorederAt:[2022-02-01 TO null] would need to be granted some semantics).

This being set there is a filter that can be used to express booealn value that has not been set:

        "filters": [
            "-DomainTest.IsValid:true",
            "-DomainTest.IsValid:false"
        ]

I hope that this will work for you.

Thanks for your explanation.