In Elasticsearch 2.2.0, how to do a filter-only query?

(Tim Bessie) #1

In Elasticsearch 1.5.2 I used:

                builder = builder.setQuery(QueryBuilders.filteredQuery(null, afb));

(where "afb" was my collection of filters).

However, if I use:

                builder = builder.setQuery(QueryBuilders.boolQuery().must(null).filter(afb));

... in Elasticsearch 2.2.0, and then examine the builder with builder.toString(), I see:

    { "error" : "NullPointerException[null]"}

... this seems to indicate that using must(null) is not acceptable. If not, what can I use to create a filter-only query, with no search term?

  • Tim

(David Pilato) #2

Don't use must method.

(Tim Bessie) #3

Ah, thanks!

(system) #4