Last active
August 29, 2015 14:03
-
-
Save mrvisser/3db551b84baff0085eaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query: { | |
"query": { | |
"filtered": { | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"multi_match": { | |
"fields": [ | |
"q_high^2.0", | |
"q_low^0.75" | |
], | |
"query": "index-without-full-content-item", | |
"boost": 5 | |
} | |
}, | |
{ | |
"has_child": { | |
"type": "content_comment", | |
"query": { | |
"multi_match": { | |
"fields": [ | |
"body" | |
], | |
"query": "index-without-full-content-item" | |
} | |
}, | |
"score_type": "max" | |
} | |
} | |
], | |
"minimum_should_match": 1 | |
} | |
}, | |
"filter": { | |
"and": [ | |
{ | |
"and": [ | |
{ | |
"term": { | |
"_type": "resource" | |
} | |
}, | |
{ | |
"terms": { | |
"resourceType": [ | |
"content" | |
] | |
} | |
} | |
] | |
}, | |
{ | |
"or": [ | |
{ | |
"and": [ | |
{ | |
"or": [ | |
{ | |
"term": { | |
"visibility": "public" | |
} | |
}, | |
{ | |
"and": [ | |
{ | |
"term": { | |
"tenantAlias": "camtest" | |
} | |
}, | |
{ | |
"or": [ | |
{ | |
"term": { | |
"visibility": "loggedin" | |
} | |
}, | |
{ | |
"and": [ | |
{ | |
"term": { | |
"resourceType": "group" | |
} | |
}, | |
{ | |
"terms": { | |
"joinable": [ | |
"yes", | |
"request" | |
] | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"term": { | |
"tenantAlias": "camtest" | |
} | |
} | |
] | |
}, | |
{ | |
"has_child": { | |
"type": "resource_members", | |
"query": { | |
"or": [ | |
{ | |
"terms": { | |
"direct_members": [ | |
"u:camtest:eyZvfPLPdxe" | |
] | |
} | |
}, | |
{ | |
"terms": { | |
"direct_members": [ | |
"resource_memberships", | |
"u:camtest:eyZvfPLPdxe#resource_memberships#", | |
"direct_memberships" | |
] | |
} | |
} | |
] | |
} | |
} | |
} | |
] | |
} | |
] | |
} | |
} | |
}, | |
"size": 1, | |
"sort": [ | |
{ | |
"_score": { | |
"order": "desc" | |
} | |
}, | |
{ | |
"sort": "asc" | |
} | |
], | |
"min_score": 0.2, | |
"fields": "*" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query: { | |
"query": { | |
"filtered": { | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"multi_match": { | |
"fields": [ | |
"q_high^2.0", | |
"q_low^0.75" | |
], | |
"query": "index-without-full-content-item", | |
"boost": 5 | |
} | |
}, | |
{ | |
"has_child": { | |
"type": "content_comment", | |
"query": { | |
"multi_match": { | |
"fields": [ | |
"body" | |
], | |
"query": "index-without-full-content-item" | |
} | |
}, | |
"score_type": "max" | |
} | |
} | |
], | |
"minimum_should_match": 1 | |
} | |
}, | |
"filter": { | |
"and": [ | |
{ | |
"and": [ | |
{ | |
"term": { | |
"_type": "resource" | |
} | |
}, | |
{ | |
"terms": { | |
"resourceType": [ | |
"content" | |
] | |
} | |
} | |
] | |
}, | |
{ | |
"or": [ | |
{ | |
"and": [ | |
{ | |
"or": [ | |
{ | |
"term": { | |
"visibility": "public" | |
} | |
}, | |
{ | |
"and": [ | |
{ | |
"term": { | |
"tenantAlias": "camtest" | |
} | |
}, | |
{ | |
"or": [ | |
{ | |
"term": { | |
"visibility": "loggedin" | |
} | |
}, | |
{ | |
"and": [ | |
{ | |
"term": { | |
"resourceType": "group" | |
} | |
}, | |
{ | |
"terms": { | |
"joinable": [ | |
"yes", | |
"request" | |
] | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"term": { | |
"tenantAlias": "camtest" | |
} | |
} | |
] | |
}, | |
{ | |
"or": [ | |
{ | |
"has_child": { | |
"type": "resource_members", | |
"query": { | |
"terms": { | |
"direct_members": [ | |
"u:camtest:eyZpojPDOxx" | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"has_child": { | |
"type": "resource_members", | |
"query": { | |
"terms": { | |
"direct_members": [ | |
"resource_memberships", | |
"u:camtest:eyZpojPDOxx#resource_memberships#", | |
"direct_memberships" | |
] | |
} | |
} | |
} | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
} | |
}, | |
"from": 1, | |
"size": 25, | |
"sort": [ | |
{ | |
"_score": { | |
"order": "desc" | |
} | |
}, | |
{ | |
"sort": "asc" | |
} | |
], | |
"min_score": 0.2, | |
"fields": "*" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In these 2 ElasticSearch queries, one is an OR filter that wraps 2 has_child queries, and the other is a has_child query that has an internal OR filter on the terms (the
direct_members
ones). Is one expected to perform different than the other?