Recursive document hierarchy

Hi,

I am seeing problems in querying documents with recursive parents. I want
to implement a grandparent-parent-child relation with the documents of the
same type.
Here is the mapping:
PUT /test_version1
{
"mappings": {
"title": {
"_parent": {
"type": "title"
},
,
"dynamic_templates" : [ {
"title_template" : {
"mapping" : {
"type" : "multi_field",
"fields" : {
"{name}" : {
"type" : "{dynamic_type}",
"index" : "not_analyzed"
},
"standard" : {
"type" : "{dynamic_type}",
"index" : "analyzed"
}
}
},
"match_mapping_type" : "string",
"patch_match" : "*"
}
} ],

       "properties" : {
        "region": {"type": "string" }
       }
     }

}
}

I am able to obtain the hierarchy using "has_child" relation but I want to
use the "has_parent" relation. Here is some of the sample data and the
"has_parent" query:
PUT /test_version1/title/6001?parent=null
{ "region" : "US" }

PUT /test_version1/title/6000?parent=6001
{"region" : "US" }

PUT /test_version1/title/600?parent=6000&routing=6001
{"region" : "US" }

and the query:

GET /test_version1/title/_search
{
"query": {
"filtered": {

    "filter" : {
        "has_parent": {
            "parent_type": "title",
             "query": {
                 "filtered": {
                   
                    "filter": {
                        "has_parent": {
                            "parent_type": "title",
                            "query": {
                                "match": {
                                   "region" : "US"
                                }
                            }
                        }
                 }
               }
             }
        }
    }
}

}
}

Is there any error in my "has_parent" query or is there a bug/ constraint
with recursive relations?

--
Please update your bookmarks! We moved to https://discuss.elastic.co/

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/811405c0-ffa3-42aa-8838-e126efd1f2a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.