src/ElasticEngine.php
public function count(Builder $builder)
    {
        $count = 0;

        $this
            ->buildSearchQueryPayloadCollection($builder, ['highlight' => false])
            ->each(function ($payload) use (&$count) {
                $result = ElasticClient::count($payload);

                $count = $result['count'];

                if ($count > 0) {
                    return false;
                }
            });

        return $count;
    }
public function count(Builder $builder)
    {
        $count = 0;

        $this
            ->buildSearchQueryPayloadCollection($builder, ['highlight' => false])
            ->each(function ($payload) use (&$count) {
                $result = ElasticClient::count($payload);

                $count = $result['count'];

                if ($count > 0) {
                    return false;
                }
            });

        return $count;
    }
public function count ( Builder $ builder ) { $ count = 0 ; $ this -> buildSearchQueryPayloadCollection ( $ builder , [ 'highlight' => false ] ) -> each ( function ( $ payload ) use ( & $ count ) { $ result = ElasticClient :: count ( $ payload ) ; $ count = $ result [ 'count' ] ; if ( $ count > 0 ) { return false ; } } ) ; return $ count ; }
Return the number of documents found.

@param \Laravel\Scout\Builder $builder
@return int
Return the number of documents found .