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.
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.
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.
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.
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.
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.
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.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.