This might be a simple question, and if so I apologize, but I'm not sure
how to go about this.
How would I execute a query against only top-level documents? I have an
index of documents, some have child documents, but I want to exclude the
children from the query.
If you have them all in one type, you can search in that type. Like:
curl -XPOST localhost:9200/myindex/mytype/_search
On Wednesday, August 8, 2012 10:06:53 PM UTC+2, shane wrote:
This might be a simple question, and if so I apologize, but I'm not sure
how to go about this.
How would I execute a query against only top-level documents? I have an
index of documents, some have child documents, but I want to exclude the
children from the query.
Does this help? I haven't used parent-child relations in ES myself.
Den onsdagen den 8:e augusti 2012 kl. 22:06:53 UTC+2 skrev shane:
This might be a simple question, and if so I apologize, but I'm not sure
how to go about this.
How would I execute a query against only top-level documents? I have an
index of documents, some have child documents, but I want to exclude the
children from the query.
I did see that, but it seems like that only controls whether or not
results have children. What I want to do is match against all top-
level docs (regardless of existence or number of children), but not
match against any children.
Does this help? I haven't used parent-child relations in ES myself.
Den onsdagen den 8:e augusti 2012 kl. 22:06:53 UTC+2 skrev shane:
This might be a simple question, and if so I apologize, but I'm not
sure how to go about this.
How would I execute a query against only top-level documents? I have
an index of documents, some have child documents, but I want to
exclude the children from the query.
Typically, parent and child documents have different types. If this is your
case, all you need to do is to limit your search to the parent type. If for
some reason you used the same type, you can find all records that have no
parents specified by searching for -_parent:* like this:
This will return all nodes that have empty _parent field.
Igor
On Thursday, August 9, 2012 1:24:11 PM UTC-4, shane wrote:
Hi olof,
I did see that, but it seems like that only controls whether or not
results have children. What I want to do is match against all top-
level docs (regardless of existence or number of children), but not
match against any children.
Does this help? I haven't used parent-child relations in ES myself.
Den onsdagen den 8:e augusti 2012 kl. 22:06:53 UTC+2 skrev shane:
This might be a simple question, and if so I apologize, but I'm not
sure how to go about this.
How would I execute a query against only top-level documents? I have
an index of documents, some have child documents, but I want to
exclude the children from the query.
Aha, thanks Igor. Yes, I do happen to be using the same type for
parent and child. In this case, it's an index of products, and
children are variations of those products.
Shane
On Aug 9, 2012, at 12:41 PM, Igor Motov wrote:
Typically, parent and child documents have different types. If this
is your case, all you need to do is to limit your search to the
parent type. If for some reason you used the same type, you can find
all records that have no parents specified by searching for -
_parent:* like this:
This will return all nodes that have empty _parent field.
Igor
On Thursday, August 9, 2012 1:24:11 PM UTC-4, shane wrote:
Hi olof,
I did see that, but it seems like that only controls whether or not
results have children. What I want to do is match against all top-
level docs (regardless of existence or number of children), but not
match against any children.
Does this help? I haven't used parent-child relations in ES myself.
Den onsdagen den 8:e augusti 2012 kl. 22:06:53 UTC+2 skrev shane:
This might be a simple question, and if so I apologize, but I'm not
sure how to go about this.
How would I execute a query against only top-level documents? I have
an index of documents, some have child documents, but I want to
exclude the children from the query.
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.