code: public static function first($query = [])
      {
          if ($query instanceof QueryBuilder) {
              $query = $query->build();
          }
          $query['from'] = 0;
          $query['size'] = 1;
          return static::search($query)->first();
      }
docs: Execute the query and get the first result.
  
  @param QueryBuilder|array $query
  @return static