Find documents with a missing field in Kibana
Use KQL or Lucene to filter for missing indexed values, and understand why nulls, empty strings, and ignored values behave differently.
In Kibana's KQL mode, negate an existence query:
not http_referrer: *
This selects documents without an indexed value for http_referrer. It does not simply test whether that key appears in the original JSON source.
Combine it with another condition
To find 404 responses without a referrer:
status_code: 404 and not http_referrer: *
Use the field names defined by your own mapping. For an ECS-based dataset, the equivalent fields may have names such as http.response.status_code and http.request.referrer.
In Lucene mode, use the existence-query syntax instead:
NOT _exists_:http_referrer
Switch the query language before pasting the expression. Do not add explanatory # comment lines to the search bar as though it were a configuration file.
Build the same filter visually
In Discover or a dashboard, choose Add filter, select the field and the exists operator, then negate the filter using the available exclusion action. Labels and colors vary by version; inspect the actual filter rather than relying on color alone.
This is useful for identifying missing instrumentation fields, requests without user-agent data, or logs without a trace identifier. To keep only logs that do have a trace ID, use trace_id: * instead of its negation.
Understand what “missing” means
An empty string generally counts as an existing value. null and an empty array ordinarily do not. An array containing both null and a real value still has an indexed value. A configured null_value can cause an explicit null to be indexed as a substitute value.
Other mapping rules matter too. A long keyword value skipped by ignore_above, a malformed value ignored by the mapping, or a field with both indexing and doc values disabled can appear in _source while failing an existence query.
If a field is absent from the filter selector, inspect the mapping, data-view scope, and permissions. Refreshing a field list may help in some versions, but cannot make an unmapped or unsearchable field searchable.
See Elastic's KQL reference and exists query semantics.
Contact us
Join the community
to join the community
Try Guance
Start online and pay only for what you use.
Get startedChoose a Guance plan
