/** * @group functional */ public function testAggregateTwoDocumentPerTagWithOffset() { $aggr = new TopHits('top_tag_hits'); $aggr->setSize(2); $aggr->setFrom(1); $aggr->setSort(array('last_activity_date' => array('order' => 'desc'))); $resultDocs = array(); $outerAggrResult = $this->getOuterAggregationResult($aggr); foreach ($outerAggrResult['buckets'] as $bucket) { foreach ($bucket['top_tag_hits']['hits']['hits'] as $doc) { $resultDocs[] = $doc['_id']; } } $this->assertEquals(array(2, 4), $resultDocs); }