Hello,

I have uploaded curl scripts to gist
https://gist.github.com/rukshanperera/9492610.

I have a three level parent/child types as shown in the following mappings

{    "Parent" : 
     {
         "properties" : {
             "name" : {
                 "type" :"string",
                 "index":"analyzed"
             }
          }
      }
}

{
    "Child" :{
        "_parent": {
           "type": "Parent"
        },
        "properties" : {
           "name" : {
               "type" :"string",
                "index":"analyzed"
           }
        }
    }    
}


{
    "GrandChild" :{
       "_parent": {
         "type": "Child"
       },
       "properties" : {
         "name" : {
            "type" :"string",
            "index":"analyzed"
         }
       }
    }
}


I want to search for *GrandChild *documents based on its parent id (which 
is the id of a Child in this example). I used the following query but it 
does not return any hits. ( "bob" - id of  *Child *document. "alice" - id 
of *Parent *document)

curl -s -XPOST "http://localhost:9200/myindex/GrandChild/_search?routing=alice"; 
-d ' 
{
    "query" : {
        "term" : { "_parent" : "bob" }
    }
}'


However, I was able to get *Child *documents based on *Parent *id using the 
following (  "alice" - id of *Parent *document)

curl -s -XPOST "http://localhost:9200/myindex/Child/_search?routing=alice"; -d ' 
{
    "query" : {
        "term" : { "_parent" : "alice" }
    }

}


Can someone please help me to get the first query working?

Thanks,
Rukshan



-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/5619eff7-b267-429b-afc3-e4c41aedc76b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to