You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Bool Query Usageedit
Fluent DSL Exampleedit
q
.Bool(b => b
.MustNot(m => m.MatchAll())
.Should(m => m.MatchAll())
.Must(m => m.MatchAll())
.Filter(f => f.MatchAll())
.MinimumShouldMatch(1)
.Boost(2))Object Initializer Syntax Exampleedit
new BoolQuery()
{
MustNot = new QueryContainer[] { new MatchAllQuery() },
Should = new QueryContainer[] { new MatchAllQuery() },
Must = new QueryContainer[] { new MatchAllQuery() },
Filter = new QueryContainer[] { new MatchAllQuery() },
MinimumShouldMatch = 1,
Boost = 2
}Example json output.
{
"bool": {
"must": [
{
"match_all": {}
}
],
"must_not": [
{
"match_all": {}
}
],
"should": [
{
"match_all": {}
}
],
"filter": [
{
"match_all": {}
}
],
"minimum_should_match": 1,
"boost": 2.0
}
}