Skip to content
Snippets Groups Projects
Commit 6f3cba8b authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Fix top hits aggregation to respect set parameters.

parent 4353d2eb
No related branches found
No related tags found
No related merge requests found
......@@ -153,6 +153,6 @@ class TopHitsAggregation extends AbstractAggregation
}
);
return $fd;
return $this->processArray($fd);
}
}
......@@ -39,4 +39,23 @@ class TopHitsAggregationTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $aggregation->toArray());
}
/**
* Tests if adding parameters has any effect.
*/
public function testParameters()
{
$topHitsAggregation = new TopHitsAggregation('test');
$topHitsAggregation->addParameter('_source', ['include' => ['title']]);
$expectedAgg = new \stdClass();
$expectedAgg->sort = [];
$expectedAgg->_source = ['include' => ['title']];
$expected = [
'agg_test' => [
'top_hits' => $expectedAgg,
],
];
$this->assertEquals($expected, $topHitsAggregation->toArray());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment