Reputation: 701
My wish is to search docs where field_a exists, and fields_b doesn't exist. Is there a way to do this using the Lucene query syntax in Kibana (Search field in the Discover section of Kibana).
I've tried using _missing_:field_b without success (_exists_ works).
I've found this but it doesn't help much:
GET /_search
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "user"
}
}
}
}
}
Upvotes: 2
Views: 1769
Reputation: 2415
For lucene search syntax:
_exists_:field_a AND !_exists_:field_b
For elasticsearch search syntax:
{
"query" : {
"bool" : {
"must" : [
{"exists" : { "field" : "field_a" }}
],
"must_not": [
{"exists" : { "field" : "field_b" }}
]
}
}
}
Upvotes: 3