From 502a7d33e697860c36982a62135915a164bff36e Mon Sep 17 00:00:00 2001 From: huanggze Date: Wed, 15 May 2019 21:20:45 +0800 Subject: [PATCH] logging: remove redundant code Signed-off-by: huanggze --- pkg/simple/client/elasticsearch/esclient.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pkg/simple/client/elasticsearch/esclient.go b/pkg/simple/client/elasticsearch/esclient.go index 896b1a2d..73b9c530 100644 --- a/pkg/simple/client/elasticsearch/esclient.go +++ b/pkg/simple/client/elasticsearch/esclient.go @@ -158,16 +158,8 @@ type StartTimeAgg struct { } type TopHits struct { - Sort []TopHitsSort `json:"sort"` - Size int `json:"size"` -} - -type TopHitsSort struct { - Order TopHitsSortOrder `json:"time"` -} - -type TopHitsSortOrder struct { - Type string `json:"order"` + Sort []Sort `json:"sort"` + Size int `json:"size"` } type HistogramAggs struct { @@ -263,7 +255,7 @@ func createQueryRequest(param QueryParameters) (int, []byte, error) { if param.Operation == "statistics" { operation = OperationStatistics containerAgg := AggField{"kubernetes.docker_id.keyword"} - startTimeAgg := TopHits{[]TopHitsSort{{TopHitsSortOrder{"asc"}}}, 1} + startTimeAgg := TopHits{[]Sort{{Order{"asc"}}}, 1} statisticAggs := StatisticsAggs{ContainerAgg{containerAgg}, StartTimeAgg{startTimeAgg}} request.Aggs = statisticAggs request.Size = 0 -- GitLab