Reputation: 304
We are in the process of upgrading ElasticSearch and NEST from 1.6.2 -> 2.3.3.
What replaces how we do TermsExecution.And
in 2.3.3?
How can this be easily done with an unknown number of terms that need to match? e.g. before you were able to just pass in an array.
Upvotes: 1
Views: 99
Reputation: 125528
TermsExecution.And
on a terms
query should be converted to a bool
query with a conjunction of must
(or filter
, depending on query/filter context) queries, with each query being a term
query on an individual value.
For example,
client.Search<dynamic>(s => s
.Query(q => +q
.Term("field", "value1")
&& +q
.Term("field", "value2")
)
);
yields
{
"query": {
"bool": {
"filter": [
{
"term": {
"field": {
"value": "value1"
}
}
},
{
"term": {
"field": {
"value": "value2"
}
}
}
]
}
}
}
Upvotes: 2