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
}
}
]
}
}
]
}
}