Hi Adrien, I had a chance to test and I see that there is one more solution. For fields that we want to search for exist/doesn't exist add one more indexed field, like "ex_field=1" and can search by: +ex_field=1 or -ex_field=1. It works fast.
On Fri, Nov 13, 2015 at 5:21 AM, Adrien Grand <jpou...@gmail.com> wrote: > Hi Vlad, > > This is something that you generally can't do. If you have doc values > enabled on your fields, you can use Lucene's FieldValueQuery, but beware > that this query is very slow. Otherwise if your field is indexed, you can > run a TermRangeQuery that has both bounds open but this will be even slower > (and by that I mean that this could never return on a large index). So > generally the best way to address this problem is to solve it by indexing a > meta-data field that contains the list of the fields that a document > contains. Then you can filter documents that have a field or not by running > a TermQuery against this field. > > > Le mer. 11 nov. 2015 à 22:43, Vlad K <kuzmi...@gmail.com> a écrit : > > > Hello, > > > > I read some discussions at Internet and still don't see if there is an > > official Lucene's solution to support: "query documents where Field > Doesn't > > exist" > > > > Do you know if there is some recommended solution? > > > > Thanks, > > Vladimir Kuzmin > > >