Parent query?

How do I get all "one" _ids who has parent of referenceOne?

i.e. "referenceOne/one"

Here is the data.

What I want is "0000015a-5819-d3ce-afda-5bbb77040000". I thought maybe a terms query would work, but I am not seeing it. There might be more than one _id if there are more than 1 "one"

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html#query-dsl-terms-lookup

{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "index1",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"_id": "0000015a-5819-d3ce-afda-5bbb769e0000",
"_score": 1,
"_source": {}
},
{
"_index": "index1",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"_id": "0000015a-5819-d3ce-afda-5bbb76d50000",
"_score": 1,
"_source": {
"referenceOne": {
"_ref": "0000015a-5819-d3ce-afda-5bbb769e0000",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002"
}
}
},
{
"_index": "index1",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"_id": "0000015a-5819-d3ce-afda-5bbb77040000",
"_score": 1,
"_source": {
"one": {
"x": 0,
"y": 0,
"_location": "0.0,0.0"
}
}
},
{
"_index": "index1",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"_id": "0000015a-5819-d3ce-afda-5bbb773e0000",
"_score": 1,
"_source": {
"referenceOne": {
"_ref": "0000015a-5819-d3ce-afda-5bbb77040000",
"_type": "0000015a-5818-d3ce-afda-5bbacfea0002"
}
}
}
]
}
}

I want to get all the ids, not just one... For example this query is not what I want, since it kinda defeats the purpose.

GET /index1/0000015a-5818-d3ce-afda-5bbacfea0002/_search
{
"size": 1000,
"query": {
"bool": {
"should": [
{
"terms": {
"_id": {
"index": "index1",
"type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"id": "0000015a-5819-d3ce-afda-5bbb773e0000",
"path": "referenceOne._ref"
}
}
},
{
"terms": {
"_id": {
"index": "index1",
"type": "0000015a-5818-d3ce-afda-5bbacfea0002",
"id": "0000015a-5819-d3ce-afda-5bbb76d50000",
"path": "referenceOne._ref"
}
}
}
]
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.