You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
And Query Usageedit
A query that matches documents using the AND boolean operator on other queries.
Deprecated in 2.0.0-beta1. Use the bool query instead.
See the Elasticsearch documentation on and query for more details.
Fluent DSL Exampleedit
q
.And(c => c
.Name("named_query")
.Boost(1.1)
.Filters(
qq => qq.MatchAll(m => m.Name("query1")),
qq => qq.MatchAll(m => m.Name("query2"))
)
)Object Initializer Syntax Exampleedit
new AndQuery()
{
Name = "named_query",
Boost = 1.1,
Filters = new QueryContainer[] {
new MatchAllQuery() { Name = "query1" },
new MatchAllQuery() { Name = "query2" },
}
}Example json output.
{
"and": {
"_name": "named_query",
"boost": 1.1,
"filters": [
{
"match_all": {
"_name": "query1"
}
},
{
"match_all": {
"_name": "query2"
}
}
]
}
}