Aggregations count


(Jakub Vrchota) #1

Hi, I'm dealing with problem about aggregation problem with counts of unique documents.

I have two types e_params and e_products. E_products is an parent to e_params.

And i have this query for filtering based on user filters. With this query i count of documents in each params (like color, size, weight).

And this query working good. But not for parameter which user choose. So if user choose color: black. Counts of other params return good. But not the color. That's understandable. But I need to remove the query term of child which sets color: black. And do the aggregations of color on that. Is it possible to do in one query? Or I need to do it with multiple queries? In this count for parameter color i need other queries on parent.

array (2)
query => array (1)
bool => array (1)
must => array (3)
0 => array (1)
range => array (1)
priceVat => array (2)
from => 0.0
to => 27500.0
1 => array (1)
term => array (1)
"categories.e_category_id" => array (2)
value => 9
boost => 1.0
2 => array (1)
has_child => array (2)
type => "e_params" (8)
query => array (1)
bool => array (1)
must => array (2)
0 => array (1)
term => array (1)
param_type_id => array (2)
value => 191
boost => 1.0
1 => array (1)
terms => array (1)
param_value => array (1)
0 => "2,5" (3)
aggs => array (1)
ks => array (2)
children => array (1)
type => "e_params" (8)
aggs => array (1)
ks => array (2)
terms => array (1)
field => "param_type_id" (13)
aggs => array (1)
ks => array (1)
terms => array (1)
field => "param_value" (11)

`


(system) #2