Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CompositeAggregation example
// set default size to 10.000 => max for default configuration
$terms
->
addParameter
(
'size', ElasticsearchHelper::MAX_SIZE_VALUE
)
;
if
(
$aggregation
->
getLimit
(
)
)
{
$terms
->
addParameter
(
'size',
(string)
$aggregation
->
getLimit
(
)
)
;
}
return
$terms
;
}
$composite
=
new
CompositeAggregation
(
$aggregation
->
getName
(
)
)
;
$accessor
=
$this
->
buildAccessor
(
$definition
,
$aggregation
->
getSorting
(
)
->
getField
(
)
,
$context
)
;
$sorting
=
new
Bucketing\
TermsAggregation
(
$aggregation
->
getName
(
)
. '.sorting',
$accessor
)
;
$sorting
->
addParameter
(
'order',
$aggregation
->
getSorting
(
)
->
getDirection
(
)
)
;
$composite
->
addSource
(
$sorting
)
;
$terms
=
new
Bucketing\
TermsAggregation
(
$aggregation
->
getName
(
)
. '.key',
$fieldName
)
;
$composite
->
addSource
(
$terms
)
;
if
(
$nested
=
$aggregation
->
getAggregation
(
)
)
{