"NOT Empty" KQL query returns records with empty fields

My records have a text field called "My Field". For some records these are the empty string and for others they have a value. I want to find all the ones for which "My Field" is not the empty string. In the KQL query bar of Discover I create a query that says "NOT My Field: (empty)". This returns all the records in the index. I get the same result if I temporarily disable this query clause. If instead I create a query of the form "My Field: some value" I do get records returned.

(The data is proprietary, so I can't post an example.)

I must not be understanding something about KQL. What am I doing wrong?

Hi @wpm,

Try querying a field with "keyword" field type instead if it's present in your index mapping.
For example: not my_field.keyword: "".

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