WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Bool Dsl Complex Query Usageedit
Fluent DSL exampleedit
q.Query() && q.Query() //second bool || ( //complex nested bool (+q.Query() || +q.Query() || !q.Query() && (!q.Query() && !q.ConditionlessQuery())) // simple nested or && (q.Query() || q.Query() || q.Query()) //all conditionless bool && (q.NullQuery() || +q.ConditionlessQuery() || !q.ConditionlessQuery()) // actual bool query && (base.QueryFluent(q)))
Object Initializer syntax exampleedit
Query && Query //second bool || ( //complex nested bool (+Query || +Query || !Query && (!Query && !ConditionlessQuery)) // simple nested or && (Query || Query || Query) //all conditionless bool && (NullQuery || +ConditionlessQuery || !ConditionlessQuery) // actual bool query && (base.QueryInitializer))
Example json output.
{ "bool": { "should": [ { "bool": { "must": [ { "term": { "x": { "value": "y" } } }, { "term": { "x": { "value": "y" } } } ] } }, { "bool": { "must": [ { "bool": { "should": [ { "bool": { "filter": [ { "term": { "x": { "value": "y" } } } ] } }, { "bool": { "filter": [ { "term": { "x": { "value": "y" } } } ] } }, { "bool": { "must_not": [ { "term": { "x": { "value": "y" } } }, { "term": { "x": { "value": "y" } } } ] } } ] } }, { "bool": { "should": [ { "term": { "x": { "value": "y" } } }, { "term": { "x": { "value": "y" } } }, { "term": { "x": { "value": "y" } } } ] } }, { "bool": { "must": [ { "match_all": {} } ], "must_not": [ { "match_all": {} } ], "should": [ { "match_all": {} } ], "filter": [ { "match_all": {} } ], "minimum_should_match": 1, "boost": 2.0 } } ] } } ] } }