August Flanagan
August Flanagan

Reputation: 896

Solr Query - return all results that do not contain a certain field

Is there any way to write a query that will return all results that do not contain a certain field?

For example, let's say that I have an index of people that contains firstName, lastName and birthDate. I want to query for all people who do not have a birthDate. NOT all people where birthDate is null, but all people where there simply is no birthDate field. Is this possible?

EDIT: MATAN pointed me to the answer here - solr search for documents where a field doesn't exist

Upvotes: 2

Views: 5075

Answers (1)

HenioJR
HenioJR

Reputation: 634

You can use negative at field. like that:

-birthDate:*
or
-birthDate:[* TO *]

Upvotes: 2

Related Questions