src/ElasticsearchModel.php
public static function all($query = [])
    {
        if ($query instanceof QueryBuilder) {
            $query = $query->build();
        }
        $collection = collect();
        static::map($query, function (ElasticsearchModel $document) use ($collection) {
            $collection->put($document->getId(), $document);
        });
        return $collection;
    }
public static function all($query = [])
    {
        if ($query instanceof QueryBuilder) {
            $query = $query->build();
        }
        $collection = collect();
        static::map($query, function (ElasticsearchModel $document) use ($collection) {
            $collection->put($document->getId(), $document);
        });
        return $collection;
    }
Execute the query and get all items.

@param QueryBuilder|array $query
@return Collection|static[]