From d6f800d573a1ce7f93a30ce95384edca5d29d5d1 Mon Sep 17 00:00:00 2001 From: Corey Ogburn Date: Mon, 22 Jul 2024 12:06:55 -0600 Subject: [PATCH] No More Overshadowing Error When making the initial search, if an error was returned we put it in a variable with a limited, shadowing scope. By the time the function has returned, that error has gone out of scope and is not reported. This caused an empty result set to appear to not be an error. --- server/modules/elastic/elasticeventstore.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/modules/elastic/elasticeventstore.go b/server/modules/elastic/elasticeventstore.go index e200cfe1..038eff66 100644 --- a/server/modules/elastic/elasticeventstore.go +++ b/server/modules/elastic/elasticeventstore.go @@ -231,7 +231,9 @@ func (store *ElasticEventstore) Scroll(ctx context.Context, criteria *model.Even indexes = strings.Split(store.index, ",") } - res, err := store.esClient.Search( + var res *esapi.Response + + res, err = store.esClient.Search( store.esClient.Search.WithContext(ctx), store.esClient.Search.WithIndex(indexes...), store.esClient.Search.WithBody(strings.NewReader(query)),