ES 2.0 Where is FilterBulders?


(Eugene Strokin) #1

Seems like the question which should have answer by now, but I couldn't find it.
Couldn't find FilterBuilders class to apply a simple IN filter.

.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.?????)))

Could someone point me to the right direction?

Thanks,
Eugene


(Martin Grigorov) #2

Hi,

Filters are merged with queries.


(David Pilato) #3

Use a Bool Query with a filter clause.
Filter clause accepts a QueryBuilder.


(Eugene Strokin) #4

I'm doing IN filter this way:

client.setQuery(QueryBuilders.constantScoreQuery(QueryBuilders.termsQuery("networkId", byNetworkId.keySet())))

Would this work?


(David Pilato) #5

I guess so. I think this should be super equivalent to the bool one.


(system) #6