diff --git a/quesma/queryparser/query_parser.go b/quesma/queryparser/query_parser.go index dd14bf668..80a64e959 100644 --- a/quesma/queryparser/query_parser.go +++ b/quesma/queryparser/query_parser.go @@ -32,6 +32,11 @@ func NewEmptyHighlighter() model.Highlighter { } } +const ( + defaultQueryResultSize = 10 + defaultTrackTotalHits = 10000 +) + func (cw *ClickhouseQueryTranslator) ParseQuery(body types.JSON) (*model.ExecutionPlan, error) { simpleQuery, hitsInfo, highlighter, err := cw.parseQueryInternal(body) @@ -148,17 +153,8 @@ func (cw *ClickhouseQueryTranslator) parseQueryInternal(body types.JSON) (*model if sortPart, ok := queryAsMap["sort"]; ok { parsedQuery.OrderBy = cw.parseSortFields(sortPart) } - const defaultSize = 10 - size := defaultSize - if sizeRaw, ok := queryAsMap["size"]; ok { - if sizeFloat, ok := sizeRaw.(float64); ok { - size = int(sizeFloat) - } else { - logger.WarnWithCtx(cw.Ctx).Msgf("unknown size format, size value: %v type: %T. Using default (%d)", sizeRaw, sizeRaw, defaultSize) - } - } + size := cw.parseSize(queryAsMap, defaultQueryResultSize) - const defaultTrackTotalHits = 10000 trackTotalHits := defaultTrackTotalHits if trackTotalHitsRaw, ok := queryAsMap["track_total_hits"]; ok { switch trackTotalHitsTyped := trackTotalHitsRaw.(type) { diff --git a/quesma/quesma/config/config.go b/quesma/quesma/config/config.go index 84489221c..5b1162555 100644 --- a/quesma/quesma/config/config.go +++ b/quesma/quesma/config/config.go @@ -177,16 +177,11 @@ func (c *QuesmaConfiguration) optimizersConfigAsString(s string, cfg map[string] func (c *QuesmaConfiguration) OptimizersConfigAsString() string { var lines []string - - lines = append(lines, "\n") - for indexName, indexConfig := range c.IndexConfig { if len(indexConfig.Optimizers) > 0 { lines = append(lines, c.optimizersConfigAsString(indexName, indexConfig.Optimizers)) } } - - lines = append(lines, "\n") return strings.Join(lines, "\n") } @@ -253,8 +248,16 @@ Quesma Configuration: Log Level: %v Public TCP Port: %d Ingest Statistics: %t, - Quesma Telemetry URL: %s - Optimizers: %s`, + Quesma Telemetry URL: %s, + Optimizers: %s, + DisableAuth: %t, + AutodiscoveryEnabled: %t, + EnableIngest: %t, + CreateCommonTable: %t, + UseCommonTableForWildcard: %t, + DefaultIngestTarget: %v, + DefaultQueryTarget: %v, +`, c.TransparentProxy, elasticUrl, elasticsearchExtra, @@ -268,6 +271,13 @@ Quesma Configuration: c.IngestStatistics, quesmaInternalTelemetryUrl, c.OptimizersConfigAsString(), + c.DisableAuth, + c.AutodiscoveryEnabled, + c.EnableIngest, + c.CreateCommonTable, + c.UseCommonTableForWildcard, + c.DefaultIngestTarget, + c.DefaultQueryTarget, ) } diff --git a/quesma/testdata/requests.go b/quesma/testdata/requests.go index 1bf565feb..84c5c3582 100644 --- a/quesma/testdata/requests.go +++ b/quesma/testdata/requests.go @@ -63,7 +63,7 @@ var TestsAsyncSearch = []AsyncSearchTestCase{ } }, "runtime_mappings": {}, - "size": 0, + "size": "0", "track_total_hits": false }`, `{