src/ElasticsearchModel.php
public static function firstOrFail($query = [])
    {
        $model = static::first($query);
        if (is_null($model)) {
            throw new ModelNotFoundException(get_called_class());
        }
        return $model;
    }
public static function firstOrFail($query = [])
    {
        $model = static::first($query);
        if (is_null($model)) {
            throw new ModelNotFoundException(get_called_class());
        }
        return $model;
    }
Execute the query and get the first result or throw an exception.

@param QueryBuilder|array $query
@throws ModelNotFoundException
@return static