From 251bd25d027f37c9274da4f3ceeec85690fe92b3 Mon Sep 17 00:00:00 2001 From: Pongpon Sinlapa Date: Sat, 14 Jan 2023 18:34:59 +0700 Subject: [PATCH] update lib es v8 --- count.go | 4 ++-- custom.go | 4 ++-- delete.go | 4 ++-- go.mod | 2 +- go.sum | 6 ++++-- search.go | 8 ++------ 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/count.go b/count.go index 2e01b5c..43f70ab 100644 --- a/count.go +++ b/count.go @@ -4,8 +4,8 @@ import ( "bytes" "encoding/json" - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" + "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v8/esapi" ) // CountRequest represents a request to get the number of matches for a search diff --git a/custom.go b/custom.go index 17186cf..35d0fad 100644 --- a/custom.go +++ b/custom.go @@ -1,8 +1,8 @@ package esquery import ( - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" + "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v8/esapi" ) // CustomQueryMap represents an arbitrary query map for custom queries. diff --git a/delete.go b/delete.go index 4e5163d..dc50bf8 100644 --- a/delete.go +++ b/delete.go @@ -4,8 +4,8 @@ import ( "bytes" "encoding/json" - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" + "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v8/esapi" ) // DeleteRequest represents a request to ElasticSearch's Delete By Query API, diff --git a/go.mod b/go.mod index d17acbf..c82f4d0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aquasecurity/esquery go 1.13 require ( - github.com/elastic/go-elasticsearch/v7 v7.6.0 + github.com/elastic/go-elasticsearch/v8 v8.6.0 // indirect github.com/fatih/structs v1.1.0 github.com/jgroeneveld/schema v1.0.0 // indirect github.com/jgroeneveld/trial v2.0.0+incompatible diff --git a/go.sum b/go.sum index fae67ff..4807af9 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -github.com/elastic/go-elasticsearch/v7 v7.6.0 h1:sYpGLpEFHgLUKLsZUBfuaVI9QgHjS3JdH9fX4/z8QI8= -github.com/elastic/go-elasticsearch/v7 v7.6.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= +github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c h1:onA2RpIyeCPvYAj1LFYiiMTrSpqVINWMfYFRS7lofJs= +github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI= +github.com/elastic/go-elasticsearch/v8 v8.6.0 h1:xMaSe8jIh7NHzmNo9YBkewmaD2Pr+tX+zLkXxhieny4= +github.com/elastic/go-elasticsearch/v8 v8.6.0/go.mod h1:Usvydt+x0dv9a1TzEUaovqbJor8rmOHy5dSmPeMAE2k= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/jgroeneveld/schema v1.0.0 h1:J0E10CrOkiSEsw6dfb1IfrDJD14pf6QLVJ3tRPl/syI= diff --git a/search.go b/search.go index 5c661a2..adad2f9 100644 --- a/search.go +++ b/search.go @@ -6,8 +6,8 @@ import ( "fmt" "time" - "github.com/elastic/go-elasticsearch/v7" - "github.com/elastic/go-elasticsearch/v7/esapi" + "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v8/esapi" ) // SearchRequest represents a request to ElasticSearch's Search API, described @@ -26,7 +26,6 @@ type SearchRequest struct { sort Sort source Source timeout *time.Duration - } // Search creates a new SearchRequest object, to be filled via method chaining. @@ -113,8 +112,6 @@ func (req *SearchRequest) Highlight(highlight Mappable) *SearchRequest { return req } - - // Map implements the Mappable interface. It converts the request to into a // nested map[string]interface{}, as expected by the go-elasticsearch library. func (req *SearchRequest) Map() map[string]interface{} { @@ -155,7 +152,6 @@ func (req *SearchRequest) Map() map[string]interface{} { m["search_after"] = req.searchAfter } - source := req.source.Map() if len(source) > 0 { m["_source"] = source