From fac98d90848a7da187858ff2567e2ea1e952dc3d Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Fri, 20 Sep 2024 11:06:30 -0400 Subject: [PATCH] Elasticsearch: Fix source for invalid query error (#93501) --- pkg/tsdb/elasticsearch/data_query.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/tsdb/elasticsearch/data_query.go b/pkg/tsdb/elasticsearch/data_query.go index 9d5338a5515..405d3b87cb6 100644 --- a/pkg/tsdb/elasticsearch/data_query.go +++ b/pkg/tsdb/elasticsearch/data_query.go @@ -77,7 +77,7 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { e.logger.Info("Prepared request", "queriesLength", len(queries), "duration", time.Since(start), "stage", es.StagePrepareRequest) res, err := e.client.ExecuteMultisearch(req) if err != nil { - // We are returning error containing the source that was added trough errorsource.Middleware + // We are returning error containing the source that was added through errorsource.Middleware return errorsource.AddErrorToResponse(e.dataQueries[0].RefID, response, err), nil } @@ -87,7 +87,7 @@ func (e *elasticsearchDataQuery) execute() (*backend.QueryDataResponse, error) { func (e *elasticsearchDataQuery) processQuery(q *Query, ms *es.MultiSearchRequestBuilder, from, to int64) error { err := isQueryWithError(q) if err != nil { - err = fmt.Errorf("received invalid query. %w", err) + err = errorsource.DownstreamError(fmt.Errorf("received invalid query. %w", err), false) return err }