From 580e1d1aefb8227e54149e0e05f20f71d5184da9 Mon Sep 17 00:00:00 2001 From: Jeremiah Buddenhagen Date: Tue, 26 Feb 2019 10:49:51 -0800 Subject: [PATCH] relax elastic search query size limits --- httpapi/commonParams.go | 6 +++--- httpapi/elastic.go | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/httpapi/commonParams.go b/httpapi/commonParams.go index f85b0fd..956cc5a 100644 --- a/httpapi/commonParams.go +++ b/httpapi/commonParams.go @@ -64,9 +64,9 @@ func commonParameterParser(next http.Handler) http.Handler { } limit := r.FormValue("limit") - size, _ := strconv.ParseInt(limit, 10, 0) - if size <= 0 || size > 1000 { - size = -1 + var size int64 = -1 + if limit != "" { + size, _ = strconv.ParseInt(limit, 10, 32) } ctx = context.WithValue(ctx, oipdSizeKey, int(size)) diff --git a/httpapi/elastic.go b/httpapi/elastic.go index cec5846..c281b39 100644 --- a/httpapi/elastic.go +++ b/httpapi/elastic.go @@ -38,9 +38,7 @@ func BuildCommonSearchService(ctx context.Context, indexNames []string, query *e Query(query) size := GetSizeFromContext(ctx) - if size != 0 { - searchService = searchService.Size(size) - } + searchService = searchService.Size(size) nSorts := GetSortInfoFromContext(ctx) nSorts = append(nSorts, sorts...)