From 944f4e06d347c111a0ffba352ea4cfb226ef422d Mon Sep 17 00:00:00 2001 From: Mahad Zaryab Date: Sun, 5 Jan 2025 21:43:48 -0500 Subject: [PATCH] Change Source Function To Have Same Behaviour With Archive Signed-off-by: Mahad Zaryab --- plugin/storage/es/spanstore/reader.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index d6876148faf..a483659fc5f 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -138,7 +138,7 @@ func NewSpanReader(p SpanReaderParams) *SpanReader { p.Logger, getTimeRangeIndexFn(p.Archive, p.UseReadWriteAliases, p.RemoteReadClusters), ), - sourceFn: getSourceFn(p.Archive, p.MaxDocCount), + sourceFn: getSourceFn(p.MaxDocCount), maxDocCount: p.MaxDocCount, useReadWriteAliases: p.UseReadWriteAliases, logger: p.Logger, @@ -201,16 +201,13 @@ func addRemoteReadClusters(fn timeRangeIndexFn, remoteReadClusters []string) tim } } -func getSourceFn(archive bool, maxDocCount int) sourceFn { +func getSourceFn(maxDocCount int) sourceFn { return func(query elastic.Query, nextTime uint64) *elastic.SearchSource { - s := elastic.NewSearchSource(). + return elastic.NewSearchSource(). Query(query). - Size(maxDocCount) - if !archive { - s.Sort("startTime", true). - SearchAfter(nextTime) - } - return s + Size(maxDocCount). + Sort("startTime", true). + SearchAfter(nextTime) } }