From a081090da71999190b80e4fd800cf789e9770e64 Mon Sep 17 00:00:00 2001 From: Tiago Queiroz Date: Mon, 27 Nov 2023 10:01:51 +0100 Subject: [PATCH] debug logs --- pkg/testing/tools/estools/elasticsearch.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/testing/tools/estools/elasticsearch.go b/pkg/testing/tools/estools/elasticsearch.go index 5e4a8c3f7b0..36788dd39d7 100644 --- a/pkg/testing/tools/estools/elasticsearch.go +++ b/pkg/testing/tools/estools/elasticsearch.go @@ -533,7 +533,22 @@ func performQueryForRawQuery(ctx context.Context, queryRaw map[string]interface{ return Documents{}, fmt.Errorf("error performing ES search: %w", err) } - return handleDocsResponse(res) + docs, err := handleDocsResponse(res) + + fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") + fmt.Println("Query:") + query, debugErr := json.MarshalIndent(queryRaw, "|", " ") + if debugErr != nil { + fmt.Println("Error marshalling 'queryRaw':", debugErr) + return docs, err + } + fmt.Println("Raw Query") + fmt.Println(string(query)) + fmt.Println("Documents docs.Hits.Total.Value: ", docs.Hits.Total.Value) + fmt.Println("Documents len(docs.Hits.Hits): ", len(docs.Hits.Hits)) + fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") + + return docs, err } // GetLogsForDatastream returns any logs associated with the datastream