From 945b93b133d7baa61ec0e9fabfe046e28bdd3eb8 Mon Sep 17 00:00:00 2001 From: ismail Date: Fri, 14 Jun 2024 11:00:26 +0200 Subject: [PATCH] change variable type from bool to string --- internals/export/elasticsearch.go | 11 ++++++----- internals/export/wrapper.go | 2 +- internals/handlers/export_handlers.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internals/export/elasticsearch.go b/internals/export/elasticsearch.go index e2753b8..5c9ec7f 100644 --- a/internals/export/elasticsearch.go +++ b/internals/export/elasticsearch.go @@ -3,12 +3,13 @@ package export import ( "context" "errors" + "strings" + "time" + es "github.com/elastic/go-elasticsearch/v8" "github.com/elastic/go-elasticsearch/v8/typedapi/core/search" "github.com/myrteametrics/myrtea-engine-api/v5/internals/config/esconfig" "github.com/myrteametrics/myrtea-sdk/v5/elasticsearch" - "strings" - "time" "github.com/elastic/go-elasticsearch/v8/typedapi/core/closepointintime" "github.com/elastic/go-elasticsearch/v8/typedapi/types" @@ -28,7 +29,7 @@ type ElasticParams struct { Limit int64 SearchRequest *search.Request IgnoreUnavailable bool - AllowNoIndices bool + AllowNoIndices string } // NewStreamedExport returns a pointer to a new StreamedExport instance @@ -167,8 +168,8 @@ func (export StreamedExport) ProcessStreamedExport(ctx context.Context, params E Request(params.SearchRequest). Size(size) - if params.AllowNoIndices { - searchRequest = searchRequest.AllowNoIndices(true) + if params.AllowNoIndices != "" { + searchRequest = searchRequest.AllowNoIndices(params.AllowNoIndices == "true") } response, err := searchRequest.Do(context.Background()) diff --git a/internals/export/wrapper.go b/internals/export/wrapper.go index 297a3d2..e81c836 100644 --- a/internals/export/wrapper.go +++ b/internals/export/wrapper.go @@ -59,7 +59,7 @@ type WrapperItem struct { ElasticName string `json:"elasticName"` Indices string `json:"-"` SearchRequest *search.Request `json:"-"` - AllowNoIndices bool `json:"-"` + AllowNoIndices string `json:"-"` IgnoreUnavailable bool `json:"-"` } diff --git a/internals/handlers/export_handlers.go b/internals/handlers/export_handlers.go index e335f6c..a65bce4 100644 --- a/internals/handlers/export_handlers.go +++ b/internals/handlers/export_handlers.go @@ -50,7 +50,7 @@ type CustomExportRequest struct { SearchRequest search.Request `json:"searchRequest"` ElasticName string `json:"elasticName"` IgnoreUnavailableIndices bool `json:"ignoreUnavailableIndices"` - AllowNoIndices bool `json:"allowNoIndices"` + AllowNoIndices string `json:"allowNoIndices"` } // ExportFactStreamed godoc