如何搜索没有特定字段的documents/records?

How to search for documents/records that doesn't have a certain field?

例如,这是我做的查询:

server:"xxx.xxx.com" AND request_url:"/xxx/xxx/xxx" AND http_X_Forwarded_Proto:(https OR http)

现在,如果我想搜索所有没有 http_X_Forwarded_Proto 字段的 documents/records,我该怎么办?我试过了:

server:"xxx.xxx.com" AND request_url:"/xxx/xxx/xxx" AND http_X_Forwarded_Proto:"-"

它没有用...

您需要在 Kibana Discover 搜索栏上使用 -_exists_

例如查看字段http_X_Forwarded_Proto不存在的文档,需要使用:-_exists_:http_X_Forwarded_Proto

要查看该字段存在的文档,只需从搜索中删除 -_exists_:http_X_Forwarded_Proto

如果您使用的是最新版本的 Kibana,您还可以点击搜索栏下方的 Add a filter,选择字段,然后 select existdoes not exist