_parent not returned by search


(byuva) #1

I am performing a search on objects which have parents. I don't actually need the parent object just its id (and the contents of the child). I expected this to be returned in the query results (along with _id) and can't seem to find an alternative way of obtaining it.

-b


(Shay Banon) #2

If you ask the _parent in the fields (and possibly _source), you should get it back, no?
On Thursday, January 27, 2011 at 8:35 PM, byuva wrote:

I am performing a search on objects which have parents. I don't actually
need the parent object just its id (and the contents of the child). I
expected this to be returned in the query results (along with _id) and can't
seem to find an alternative way of obtaining it.

-b

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/parent-not-returned-by-search-tp2363469p2363469.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(byuva) #3

Yes, it seems to be working now that I specified _parent in "fields". My initial reaction was that when no fields are specified I would expect "_parent" to be returned just like _id and _source. I viewed fields as a way to restrict what is returned, not add to it. It is certainly not difficult to specify this in fields although I note that pyes doesn't currently allow fields to be specified everywhere (eg get). I'll see if I can create a pull request for this for aparo.

-brian


(Shay Banon) #4

By default, only _id, _type and _source are returned. Parent is not on the same level as _id, so you need to explicitly ask for it.
On Sunday, January 30, 2011 at 7:46 PM, byuva wrote:

Yes, it seems to be working now that I specified _parent in "fields". My
initial reaction was that when no fields are specified I would expect
"_parent" to be returned just like _id and _source. I viewed fields as a
way to restrict what is returned, not add to it. It is certainly not
difficult to specify this in fields although I note that pyes doesn't
currently allow fields to be specified everywhere (eg get). I'll see if I
can create a pull request for this for aparo.

-brian

View this message in context: http://elasticsearch-users.115913.n3.nabble.com/parent-not-returned-by-search-tp2363469p2384351.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(byuva) #5

I am a bit surprised as it seems most of the other fields submitted
with the record are returned by default (although I can also see the
argument that it is not always present). Are there any other fields
that can be added? Perhaps a bit more in the documentation would
help. It can be a bit confusing knowing what field to use when parent
is "parent" when url_encoded and "_parent" when posted.

-brian

On Jan 30, 12:48 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

By default, only _id, _type and _source are returned. Parent is not on the same level as _id, so you need to explicitly ask for it.

On Sunday, January 30, 2011 at 7:46 PM, byuva wrote:

Yes, it seems to be working now that I specified _parent in "fields". My
initial reaction was that when no fields are specified I would expect
"_parent" to be returned just like _id and _source. I viewed fields as a
way to restrict what is returned, not add to it. It is certainly not
difficult to specify this in fields although I note that pyes doesn't
currently allow fields to be specified everywhere (eg get). I'll see if I
can create a pull request for this for aparo.

-brian

View this message in context:http://elasticsearch-users.115913.n3.nabble.com/parent-not-returned-b...
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Shay Banon) #6

Its done for performance reasons, you don't want the _parent all the times. The other one that is also automatically stored and is fetchable is _routing (if used).
On Saturday, February 5, 2011 at 1:28 AM, merrellb wrote:

I am a bit surprised as it seems most of the other fields submitted
with the record are returned by default (although I can also see the
argument that it is not always present). Are there any other fields
that can be added? Perhaps a bit more in the documentation would
help. It can be a bit confusing knowing what field to use when parent
is "parent" when url_encoded and "_parent" when posted.

-brian

On Jan 30, 12:48 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

By default, only _id, _type and _source are returned. Parent is not on the same level as _id, so you need to explicitly ask for it.

On Sunday, January 30, 2011 at 7:46 PM, byuva wrote:

Yes, it seems to be working now that I specified _parent in "fields". My
initial reaction was that when no fields are specified I would expect
"_parent" to be returned just like _id and _source. I viewed fields as a
way to restrict what is returned, not add to it. It is certainly not
difficult to specify this in fields although I note that pyes doesn't
currently allow fields to be specified everywhere (eg get). I'll see if I
can create a pull request for this for aparo.

-brian

View this message in context:http://elasticsearch-users.115913.n3.nabble.com/parent-not-returned-b...
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #7