-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a has_parent query #792
Comments
+1 this feature would be very useful ! |
I've just tested it and It works like a charm ! It's a really nice feature, congratulations. |
Great feature. thank you hlian ! |
This looks really useful, thanks. Is this ready for prime time or still a work in progress? Have you approached Shay about getting this merged in? |
Thank you for the kind words, guys. @kevingessner and I are crazy busy right now getting a release out and @flxs is doing a lot of the hard work to get the stuff merge-ready, so I'd like to bless his branch as the place for has_parent development to happen. I'd be happy to answer questions about the implementation, but I'm afraid either of us can't commit to writing more code for this feature or to spending time shepherding it into trunk. |
I just tried @flxs's branch and can confirm that this filter is officially awesome :) It has allowed me to redesign my un-scalable app (relying on frequent and expensive re-indexing of docs + nested docs) to a fully scalable one using parent & child docs instead. Thanks to @hilan, @kevingessner and @flxs for getting it working - hope it finds its way into trunk soon. BTW, if there are any other java-illiterates reading this thread who, like me, can't figure out how to get the download working, you need to make sure all dependencies are assembled in the target/lib directory by running the following (from the root folder): $ mvn prepare-package -DskipTests and then run ES with: $ ES_CLASSPATH="target/classes:target/lib/*" bin/elasticsearch -f (from http://bit.ly/HKmckR) Thanks again. |
I've added a gist for testing the has_parent search filter from commandline using curl against the json API: https://gist.github.com/2865256. |
+1 |
UPDATE I've narrowed down the problem. If I create the index and add some parent and child docs, the has_parent filter doesn't work until I restart the server. However, this only works once. If I add additional child docs, or if I update the existing ones, the results of the has_parent filter don't reflect the changes. It's as if the filter is working with a stale copy of the data set - very weird... I was wondering if someone on this thread could help me. The has_parent fork was working really nicely, but has now suddenly stopped working - which has left me thoroughly confused! I haven't changed anything as far as I know. I downloaded and built @flxs's branch 3 months ago and it worked just fine. But when I revisited my test index today it seems to be broken. The has_child filter continues to work as normal, but has_parent seems to ignore newly indexed documents. Sometimes restarting the server will make it pick them up but mostly not. Can anyone think why this might be? Does ES have runtime dependencies that might have been changed by system updates (I'm on Ubuntu 11.04)? |
It looks like this solves the exact problem I'm tackling right now. Any idea when it'll be ready for prime time? |
Hi everyone, I'm very interested by this filter, so I'd like to know if you consider it's ready for production or if it is still unstable. @jmchambers : Did you fix your troubles since 2 month or do you need help to investigate the problem ? @kimchy : Do you have any plan to integrate the has_parent filter in 0.20 ? Cheers, |
I really need this capability. |
The `has_parent` filter accepts a query and a parent type. The query is executed in the parent document space, which is specified by the parent type. This filter return child documents which associated parents have matched. For the rest `has_parent` filter has the same options and works in the same manner as the `has_child` filter. This is an experimental filter. Filter example ################### ``` { "has_parent" : { "parent_type" : "blog" "query" : { "term" : { "tag" : "something" } } } } ``` The `parent_type` field name can also be abbreviated to `type`. Memory considerations ############### With the current implementation, all _id values are loaded to memory (heap) in order to support fast lookups, so make sure there is enough mem for it. This issue originates from issue elastic#792
The `has_parent` filter accepts a query and a parent type. The query is executed in the parent document space, which is specified by the parent type. This filter return child documents which associated parents have matched. For the rest `has_parent` filter has the same options and works in the same manner as the `has_child` filter. This is an experimental filter. Filter example ################### ``` { "has_parent" : { "parent_type" : "blog" "query" : { "term" : { "tag" : "something" } } } } ``` The `parent_type` field name can also be abbreviated to `type`. Memory considerations ############### With the current implementation, all _id values are loaded to memory (heap) in order to support fast lookups, so make sure there is enough mem for it. This issue originates from issue #792
The `has_parent` filter accepts a query and a parent type. The query is executed in the parent document space, which is specified by the parent type. This filter return child documents which associated parents have matched. For the rest `has_parent` filter has the same options and works in the same manner as the `has_child` filter. This is an experimental filter. Filter example ################### ``` { "has_parent" : { "parent_type" : "blog" "query" : { "term" : { "tag" : "something" } } } } ``` The `parent_type` field name can also be abbreviated to `type`. Memory considerations ############### With the current implementation, all _id values are loaded to memory (heap) in order to support fast lookups, so make sure there is enough mem for it. This issue originates from issue #792
This has been pushed in #2243 and will be available 0.19.10 |
great news, thanks for getting this in the main release. @nhuray afraid I didn't get it working, but I'll give it another try with 0.19.10, thanks for asking though. |
The `has_parent` filter accepts a query and a parent type. The query is executed in the parent document space, which is specified by the parent type. This filter return child documents which associated parents have matched. For the rest `has_parent` filter has the same options and works in the same manner as the `has_child` filter. This is an experimental filter. Filter example ################### ``` { "has_parent" : { "parent_type" : "blog" "query" : { "term" : { "tag" : "something" } } } } ``` The `parent_type` field name can also be abbreviated to `type`. Memory considerations ############### With the current implementation, all _id values are loaded to memory (heap) in order to support fast lookups, so make sure there is enough mem for it. This issue originates from issue elastic#792
Would return children objects similar to how the has_child query returns parent objects.
The text was updated successfully, but these errors were encountered: