src/ElasticsearchModel.php
public static function first($query = [])
    {
        if ($query instanceof QueryBuilder) {
            $query = $query->build();
        }
        $query['from'] = 0;
        $query['size'] = 1;
        return static::search($query)->first();
    }
public static function first($query = [])
    {
        if ($query instanceof QueryBuilder) {
            $query = $query->build();
        }
        $query['from'] = 0;
        $query['size'] = 1;
        return static::search($query)->first();
    }
public static function first ( $ query = [ ] ) { if ( $ query instanceof QueryBuilder ) { $ query = $ query -> build ( ) ; } $ query [ 'from' ] = 0 ; $ query [ 'size' ] = 1 ; return static :: search ( $ query ) -> first ( ) ; }
Execute the query and get the first result.

@param QueryBuilder|array $query
@return static
Execute the query and get the first result .