This (present/absent) condition is there during the indexing time. So,
apply the optimization at the indexing rather than at the search time.

Have a custom UpdateRequestProcessor chain that will create a boolean
flag that matches "body" presence/absence.

You can do that with copy, default-value and regex I think, though
there may be more elegant combinations. The goal is that by the time
that copied field hits the schema, it matches a boolean field
definition for most efficiency.

Regards,
   Alex.

On Wed, 28 Jul 2021 at 11:55, mtn search <search...@gmail.com> wrote:
>
> Hello,
>
> Some documents in my collection have an empty body field.
>     "body":"",
>
> I am looking for a query to find docs with a body field with this "empty"
> value.
>
> Normally, I might run with a filter
>     fq=-body:*
>
> On this large set of shards that I am querying it times out with the
> wildcard.  On smaller sets, it shows when there is no body field.
>
> Other attempts at representing a value of "" in the filter query have not
> worked.
>
> Any tips?
>
> Thanks,
> Matthew

Reply via email to