Filter to include if value is null or doesn't exist

I want to filter the document if the field is null or empty. I haven't found a way to do this in AppSearch and don't see it mentioned in the docs. Is there a way to accomplish this? Does AppSearch use the Elastic null_value field when no value is insert in the document?

To my knowledge there is no way to do an "exists" filter like in Elasticsearch. Can you do something like the following?

{
  "query": "parks",
  "filters": {
"filters" : {
    "all": {
      "any": [
          { "some_field": "" },
          { "some_field": null }
        ]
      }
    }
  }
}'

This still wouldn't account for all of the scenarios an Elasticsearch "exist" does (Exists query | Elasticsearch Guide [7.13] | Elastic), but it might get you close.

Unfortunately, your best bet with App Search is probably to pre-process your data to have consistent "empty" values (like "", for example).

We have decided to go with an EMPTY constant in the data processing step and then filter on that.

Thanks @JasonStoltz

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.