On Wednesday, March 11, 2015 at 6:23:40 PM UTC-4, Perryn Fowler wrote:
'apply the filter before the query' doesn't make any sense to me - what
would it filter? I suspect I'm not really understanding you, can you tell
me more? Why do you want to be able to do this? How would it help?
The scenario is actually a very common one. We have a common field to all
document types (regardless of parent or child) whose purpose is to control
access. In this simple example, the access field represents this common
field. Ideally, it would be much simpler to be able to specify a filter
then query strategy in the filtered query which would apply the term
filter to all documents before the query is executed regardless of whether
or not the query included a has_parent query.
anyway, from what I thing I do understand there are several ways to get
the results you want. Which one you choose probably depends on how you want
the results scored, and possibly performance considerations.here is one way to try. (If you want to filter both then you need to ...
apply the filter to both :))
something like:{
"query": {
"filtered": {
"query": {
"has_child": {
"type": "Bar",
"query": {
"filtered": {
"query": {
"term": {
"bar": "xyz"
}
},
"filter": {
"term": {
"access": "yes"
}
}
}
}
}
},
"filter": {
"term": {
"access": "yes"
}
}
}
}
}
Thank you for your work-around solution. Unfortunately, it's not ideal
though, since in practice our filters can be very large, so it really
bloats the request to have to repeat the filter clause.
Thank you for your time though.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7af03ba4-9654-49f3-98f0-b40ca297a56f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.