Skip to content
Snippets Groups Projects
Commit 8b5ce99a authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

Merge pull request #20 from GrandLTU/top-hits-fix

Fix top hits aggregation to respect set parameters.
parents 8edbd1e7 6f3cba8b
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