diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 5e0ee666..b3d265c1 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -32,6 +32,7 @@ arthurgustin [@arthurgustin](https://github.com/arthurgustin) Bas van Dijk [@basvandijk](https://github.com/basvandijk) Benjamin Fernandes [@LotharSee](https://github.com/LotharSee) Benjamin Zarzycki [@kf6nux](https://github.com/kf6nux) +bestgopher [@bestgopher](https://github.com/bestgopher) Björn Gerdau [@kernle32dll](https://github.com/kernle32dll) Boris Popovschi [@Zyqsempai](https://github.com/Zyqsempai) Bowei Xu [@vancexu](https://github.com/vancexu) diff --git a/search.go b/search.go index f47fdf5c..6e0b476a 100644 --- a/search.go +++ b/search.go @@ -691,7 +691,7 @@ func (r *SearchResult) Each(typ reflect.Type) []interface{} { if r.Hits == nil || r.Hits.Hits == nil || len(r.Hits.Hits) == 0 { return nil } - var slice []interface{} + slice := make([]interface{}, 0, len(r.Hits.Hits)) for _, hit := range r.Hits.Hits { v := reflect.New(typ).Elem() if hit.Source == nil {