Elastica\Aggregation\DateHistogram::setOffset PHP Method

setOffset() public method

Set offset option.
public setOffset ( $offset )
    public function setOffset($offset)
    {
        return $this->setParam('offset', $offset);
    }

Usage Example

 /**
  * @group functional
  */
 public function testSetOffsetWorks()
 {
     $agg = new DateHistogram('hist', 'created', '1m');
     $agg->setOffset('+40s');
     $query = new Query();
     $query->addAggregation($agg);
     $results = $this->_getIndexForTest()->search($query)->getAggregation('hist');
     $this->assertEquals('2014-01-29T00:19:40.000Z', $results['buckets'][0]['key_as_string']);
 }