I have noticed a lot of changes in ES after upgrading it from v1.9 to v5.4.
I am still having doubts about the querying techniques in ES. In v1.9 I have noticed that the Filter option differs.
I am wondering how I can replicate the below code in v5.4
searchDescriptor.Query(q => q.Filtered(m => m.Query(n => matchQuery).Filter(o => o.And(filterContainer.ToArray()))))
Here I see Filter(o => o.And(filterContainer.ToArray())
how is it possible to do an And
or an Or
operation with v5.4?
Does Filter(o => o.And(filterContainer.ToArray())
indicate that each item in the array are bound with an And
operaton?
.And()
and.Or()
were deprecated in Elasticsearch 2.0 and removed in 5.0. You can replace them with abool
query.And()
, if you require scoring, then used.Must()
. If you don't require scoring, use.Filter()
..Or()
, use.Should()
.bool
queries can be nested, so it's possible to create complex compound queries.becomes something like
filtered queries were deprecated in 2.0 and removed in 5.0.
For these, pass them to a
bool
query filter clauses, which are conjunctive i.e. and'ed. If you need toor
clauses, you can nestbool
queries with filter clauses within abool
query should clauses.