public function nested($field, \Closure $closure, $score_mode = 'avg')
    {
        $builder = new self($this->connection, new $this->query());

        $closure($builder);

        $nestedQuery = $builder->query->getQueries();

        $query = new NestedQuery($field, $nestedQuery, ['score_mode' => $score_mode]);

        $this->append($query);

        return $this;
    }
public function nested($field, \Closure $closure, $score_mode = 'avg')
    {
        $builder = new self($this->connection, new $this->query());

        $closure($builder);

        $nestedQuery = $builder->query->getQueries();

        $query = new NestedQuery($field, $nestedQuery, ['score_mode' => $score_mode]);

        $this->append($query);

        return $this;
    }
public function nested ( $ field , \ Closure $ closure , $ score_mode = 'avg' ) { $ builder = new self ( $ this -> connection , new $ this -> query ( ) ) ; $ closure ( $ builder ) ; $ nestedQuery = $ builder -> query -> getQueries ( ) ; $ query = new NestedQuery ( $ field , $ nestedQuery , [ 'score_mode' => $ score_mode ] ) ; $ this -> append ( $ query ) ; return $ this ; }
Add a nested query.

@param $field
@param \Closure $closure
@param string   $score_mode

@return $this
Add a nested query .