I have an array named "results" and within that array I have elements with
field "name" and field "failed". I'd like to do a facet search over the
"name" field across all elements of the "results" array in in all documents.
Furthermore, I'd like to be able to filter out all elements where "failed"
(the sibling of "name") is 0. How would I do this?
You will loose the notion of order between two different fields in this case. You will filter by docs that have failed set to 0, but then that doc becomes "qualified" to do terms stats on it. What you can do is separate each element in the array to a different doc.
On Wednesday, June 1, 2011 at 2:07 AM, Owen Coutts wrote:
I have an array named "results" and within that array I have elements with field "name" and field "failed". I'd like to do a facet search over the "name" field across all elements of the "results" array in in all documents. Furthermore, I'd like to be able to filter out all elements where "failed" (the sibling of "name") is 0. How would I do this?
How would I do that while keeping the meta data (at the root of the current
doc) in the index for each result? Should I create separate documents where
the meta data is repeated?
You will loose the notion of order between two different fields in this
case. You will filter by docs that have failed set to 0, but then that doc
becomes "qualified" to do terms stats on it. What you can do is separate
each element in the array to a different doc.
On Wednesday, June 1, 2011 at 2:07 AM, Owen Coutts wrote:
I have an array named "results" and within that array I have elements with
field "name" and field "failed". I'd like to do a facet search over the
"name" field across all elements of the "results" array in in all documents.
Furthermore, I'd like to be able to filter out all elements where "failed"
(the sibling of "name") is 0. How would I do this?
You will need to repeat the metadata in each document, or, use the parent child feature (at the cost of slower searches with has_child filter or top_children query).
On Wednesday, June 1, 2011 at 4:01 AM, Owen Coutts wrote:
How would I do that while keeping the meta data (at the root of the current doc) in the index for each result? Should I create separate documents where the meta data is repeated?
You will loose the notion of order between two different fields in this case. You will filter by docs that have failed set to 0, but then that doc becomes "qualified" to do terms stats on it. What you can do is separate each element in the array to a different doc.
On Wednesday, June 1, 2011 at 2:07 AM, Owen Coutts wrote:
I have an array named "results" and within that array I have elements with field "name" and field "failed". I'd like to do a facet search over the "name" field across all elements of the "results" array in in all documents. Furthermore, I'd like to be able to filter out all elements where "failed" (the sibling of "name") is 0. How would I do this?
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.