If ‘body’ field is indexed=true, Shawn’s query should give you results
where body=“” as well as where body field doesn’t exist at all.
Also, I agree that the format body:[* TO *] is much faster for high
cardinality fields (which most likely “body” is).

-Rahul

On Wed, Jul 28, 2021 at 7:46 PM Shawn Heisey <apa...@elyograg.org> wrote:

> On 7/28/2021 11:48 AM, mtn search wrote:
> > Thanks Walter, Alex!
> >
> > Yes I regularly use -  Search for *:* -body:*
>
> That syntax, while it works for finding docs where the body field is
> entirely missing, is not the best option.  You'll likely find that this
> syntax is MUCH faster, and returns identical results:
>
> *:* -body:[* TO *]
>
> The reason it's faster is that * by itself is a wildcard query, and
> unless the cardinality of the field is very low, those are extremely
> inefficient.  I would expect a field named "body" to have cardinality in
> the millions or billions, for sufficiently large indexes.
>
> Note that neither of these queries will find docs where the value is the
> empty string, because I believe that IS matched by either a wildcard
> query or a range query.
>
> Thanks,
> Shawn
>

Reply via email to