I'd like to search all parent documents that have child documents in
index, but also would like to retrieve aggregated data about child
documents for found parents.
For example: every child document has price defined as a field and I'd
like to query parent documents that have any children and in search
results I'd like to receive also minimum price value for every parent
(aggregated from this parent's children).
I tried:
statistical facet with child scope, but it returns global minimum
price (not in context of parent)
terms facet with script that was concatenating parent id with price
and from results of this facet I was able to aggregate minimum prices
for each parent
histogram script facet but keys can only be numbers (not parent ids)
and count can only be total/mean of values and not minimum
What is the best way to achieve desired functionality?
I'd like to search all parent documents that have child documents in
index, but also would like to retrieve aggregated data about child
documents for found parents.
For example: every child document has price defined as a field and I'd
like to query parent documents that have any children and in search
results I'd like to receive also minimum price value for every parent
(aggregated from this parent's children).
I tried:
statistical facet with child scope, but it returns global minimum
price (not in context of parent)
terms facet with script that was concatenating parent id with price
and from results of this facet I was able to aggregate minimum prices
for each parent
histogram script facet but keys can only be numbers (not parent ids)
and count can only be total/mean of values and not minimum
What is the best way to achieve desired functionality?
If I understood correctly, and you want to get facets per parent, then you can't do it.
On Wednesday, February 16, 2011 at 5:52 PM, Wojciech DurczyÅski wrote:
One more thing: I cannot add minimum price as a field in parent
document, because children are filtered using various conditions.
I'd like to search all parent documents that have child documents in
index, but also would like to retrieve aggregated data about child
documents for found parents.
For example: every child document has price defined as a field and I'd
like to query parent documents that have any children and in search
results I'd like to receive also minimum price value for every parent
(aggregated from this parent's children).
I tried:
statistical facet with child scope, but it returns global minimum
price (not in context of parent)
terms facet with script that was concatenating parent id with price
and from results of this facet I was able to aggregate minimum prices
for each parent
histogram script facet but keys can only be numbers (not parent ids)
and count can only be total/mean of values and not minimum
What is the best way to achieve desired functionality?
No, no direct plan, mainly because its not simple (/possible) to do it in a very efficient manner when using child / parent. You might need to change the model to support what you want.
On Wednesday, March 16, 2011 at 3:11 PM, srrIN wrote:
Hi Shay,
Do you have any plan for this feature to be incorporated in upcoming
versions?
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.