Elastica\QueryBuilder::aggregation PHP 메소드

aggregation() 공개 메소드

Aggregation DSL.
public aggregation ( ) : Aggregation
리턴 Elastica\QueryBuilder\DSL\Aggregation
    public function aggregation()
    {
        return $this->_facades[DSL::TYPE_AGGREGATION];
    }

Usage Example

예제 #1
0
 /**
  * @group unit
  */
 public function testFacadeException()
 {
     $qb = new QueryBuilder(new QueryBuilder\Version\Version100());
     // undefined
     $exceptionMessage = '';
     try {
         $qb->query()->invalid();
     } catch (QueryBuilderException $exception) {
         $exceptionMessage = $exception->getMessage();
     }
     $this->assertEquals('undefined query "invalid"', $exceptionMessage);
     // unsupported
     $exceptionMessage = '';
     try {
         $qb->aggregation()->top_hits('top_hits');
     } catch (QueryBuilderException $exception) {
         $exceptionMessage = $exception->getMessage();
     }
     $this->assertEquals('aggregation "top_hits" in Version100 not supported', $exceptionMessage);
 }