1.0.0 Beta2 - GET children for Parent/Child does not seem to work


(george_monroe) #1

Hi,

I'm doing a simple test with 1.0.0 Beta 2. I've indexed a parent record
and three children. The head plugin shows all the children, and the search
endpoint returns all three children with different id's. But, for some
strange reason, I can only GET by id one of the children. Does someone
have a clue, or could this be a bug?

curl -XGET localhost:9200/d3/transactions/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"_score" : 1.0, "_source" : { "date" : "2012-12-01", "description" :
"Nail polish", "amount" : 80.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"_score" : 1.0, "_source" : { "date" : "2012-10-14", "description" :
"Nail polish", "amount" : 70.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_score" : 1.0, "_source" : { "date" : "2013-01-01", "description" :
"Nail polish", "amount" : 75.50}
} ]
}
}

curl -XGET localhost:9200/d3/transactions/1?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_version" : 2,
"exists" : true, "_source" : { "date" : "2013-01-01", "description" :
"Nail polish", "amount" : 75.50}
}

curl -XGET localhost:9200/d3/transactions/2?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"exists" : false
}

curl -XGET localhost:9200/d3/transactions/3?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"exists" : false
}

--
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/41376241-31ab-488a-bac8-19618cbc60be%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Try with adding ?routing=PARENTID
where PARENTID is equal to the parent ID for a given child

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 10 janv. 2014 à 01:09, Yuri Panchenko yuri.panchenko@gmail.com a écrit :

Hi,

I'm doing a simple test with 1.0.0 Beta 2. I've indexed a parent record and three children. The head plugin shows all the children, and the search endpoint returns all three children with different id's. But, for some strange reason, I can only GET by id one of the children. Does someone have a clue, or could this be a bug?

curl -XGET localhost:9200/d3/transactions/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"_score" : 1.0, "_source" : { "date" : "2012-12-01", "description" : "Nail polish", "amount" : 80.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"_score" : 1.0, "_source" : { "date" : "2012-10-14", "description" : "Nail polish", "amount" : 70.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_score" : 1.0, "_source" : { "date" : "2013-01-01", "description" : "Nail polish", "amount" : 75.50}
} ]
}
}

curl -XGET localhost:9200/d3/transactions/1?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_version" : 2,
"exists" : true, "_source" : { "date" : "2013-01-01", "description" : "Nail polish", "amount" : 75.50}
}

curl -XGET localhost:9200/d3/transactions/2?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"exists" : false
}

curl -XGET localhost:9200/d3/transactions/3?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"exists" : false
}

--
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/41376241-31ab-488a-bac8-19618cbc60be%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/143F639E-7946-4F98-B003-B47FDD84F2C3%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(george_monroe) #3

Thanks David! Admittedly, this is counter intuitive and a little bit
illogical. The reason is that I'm storing child docs in a different type,
transactions (parent docs are going into type customers). Since child docs
are indexed separately, logically, it would make sense to at least fetch
them out without any reference to the parent docs. In fact, it seems that
I can pull all of them out, but not individually.

Thanks anyway!!

On Thursday, January 9, 2014 7:55:55 PM UTC-8, David Pilato wrote:

Try with adding ?routing=PARENTID
where PARENTID is equal to the parent ID for a given child

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 10 janv. 2014 à 01:09, Yuri Panchenko <yuri.pa...@gmail.com<javascript:>>
a écrit :

Hi,

I'm doing a simple test with 1.0.0 Beta 2. I've indexed a parent record
and three children. The head plugin shows all the children, and the search
endpoint returns all three children with different id's. But, for some
strange reason, I can only GET by id one of the children. Does someone
have a clue, or could this be a bug?

curl -XGET localhost:9200/d3/transactions/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"_score" : 1.0, "_source" : { "date" : "2012-12-01", "description" :
"Nail polish", "amount" : 80.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"_score" : 1.0, "_source" : { "date" : "2012-10-14", "description" :
"Nail polish", "amount" : 70.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_score" : 1.0, "_source" : { "date" : "2013-01-01", "description" :
"Nail polish", "amount" : 75.50}
} ]
}
}

curl -XGET localhost:9200/d3/transactions/1?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_version" : 2,
"exists" : true, "_source" : { "date" : "2013-01-01", "description" :
"Nail polish", "amount" : 75.50}
}

curl -XGET localhost:9200/d3/transactions/2?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"exists" : false
}

curl -XGET localhost:9200/d3/transactions/3?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"exists" : false
}

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/41376241-31ab-488a-bac8-19618cbc60be%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/21b21844-656d-440f-9277-b97a5ddfde0c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #4

Children are colocated in the same shard as parents for performance reason.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 14 janv. 2014 à 04:27, Yuri Panchenko yuri.panchenko@gmail.com a écrit :

Thanks David! Admittedly, this is counter intuitive and a little bit illogical. The reason is that I'm storing child docs in a different type, transactions (parent docs are going into type customers). Since child docs are indexed separately, logically, it would make sense to at least fetch them out without any reference to the parent docs. In fact, it seems that I can pull all of them out, but not individually.

Thanks anyway!!

On Thursday, January 9, 2014 7:55:55 PM UTC-8, David Pilato wrote:
Try with adding ?routing=PARENTID
where PARENTID is equal to the parent ID for a given child

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 10 janv. 2014 à 01:09, Yuri Panchenko yuri.pa...@gmail.com a écrit :

Hi,

I'm doing a simple test with 1.0.0 Beta 2. I've indexed a parent record and three children. The head plugin shows all the children, and the search endpoint returns all three children with different id's. But, for some strange reason, I can only GET by id one of the children. Does someone have a clue, or could this be a bug?

curl -XGET localhost:9200/d3/transactions/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 3,
"max_score" : 1.0,
"hits" : [ {
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"_score" : 1.0, "_source" : { "date" : "2012-12-01", "description" : "Nail polish", "amount" : 80.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"_score" : 1.0, "_source" : { "date" : "2012-10-14", "description" : "Nail polish", "amount" : 70.00}
}, {
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_score" : 1.0, "_source" : { "date" : "2013-01-01", "description" : "Nail polish", "amount" : 75.50}
} ]
}
}

curl -XGET localhost:9200/d3/transactions/1?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "1",
"_version" : 2,
"exists" : true, "_source" : { "date" : "2013-01-01", "description" : "Nail polish", "amount" : 75.50}
}

curl -XGET localhost:9200/d3/transactions/2?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "2",
"exists" : false
}

curl -XGET localhost:9200/d3/transactions/3?pretty
{
"_index" : "d3",
"_type" : "transactions",
"_id" : "3",
"exists" : false
}

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/41376241-31ab-488a-bac8-19618cbc60be%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/21b21844-656d-440f-9277-b97a5ddfde0c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/85E03D0F-4451-4110-973F-06BD52E0B10A%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5