Filter bool params Func<QueryContainerDescriptor<T>, QueryContainer>[],
var nameList = new string[] { "name1", "name2" };
var colorList = new string[] { "orange", "red" };
client.SearchAsync<MyDocument>(s => s
.Index("myindex")
.Query(q => q
.Bool(bq => bq
.Filter(
fq => fq.Terms(t => t.Field(f => f.Name).Terms(nameList)),
fq => fq.Terms(t => t.Field(f => f.Color).Terms(colorList))
)
)
)
);
{
"query": {
"bool": {
"filter": [
{
"terms": {
"name": [
"name1",
"name2"
]
}
},
{
"terms": {
"color": [
"orange",
"red"
]
}
}
]
}
}
}
NEST , , .
? , ; , terms , , :
var emptyNames = new string[] {};
string[] nullColors = null;
client.SearchAsync<MyDocument>(s =>
s.Index("myindex")
.Query(q => q
.Bool(bq => bq
.Filter(
fq => fq.Terms(t => t.Field(f => f.Name).Terms(emptyNames)),
fq => fq.Terms(t => t.Field(f => f.Color).Terms(nullColors)))
)
)
);
{}
NEST, , . .Strict() .Verbatim().