update lib es v8

This commit is contained in:
Pongpon Sinlapa 2023-01-14 18:34:59 +07:00
parent 49a92fc25e
commit 251bd25d02
6 changed files with 13 additions and 15 deletions

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v7/esapi" "github.com/elastic/go-elasticsearch/v8/esapi"
) )
// CountRequest represents a request to get the number of matches for a search // CountRequest represents a request to get the number of matches for a search

View File

@ -1,8 +1,8 @@
package esquery package esquery
import ( import (
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v7/esapi" "github.com/elastic/go-elasticsearch/v8/esapi"
) )
// CustomQueryMap represents an arbitrary query map for custom queries. // CustomQueryMap represents an arbitrary query map for custom queries.

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v7/esapi" "github.com/elastic/go-elasticsearch/v8/esapi"
) )
// DeleteRequest represents a request to ElasticSearch's Delete By Query API, // DeleteRequest represents a request to ElasticSearch's Delete By Query API,

2
go.mod
View File

@ -3,7 +3,7 @@ module github.com/aquasecurity/esquery
go 1.13 go 1.13
require ( 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/fatih/structs v1.1.0
github.com/jgroeneveld/schema v1.0.0 // indirect github.com/jgroeneveld/schema v1.0.0 // indirect
github.com/jgroeneveld/trial v2.0.0+incompatible github.com/jgroeneveld/trial v2.0.0+incompatible

6
go.sum
View File

@ -1,5 +1,7 @@
github.com/elastic/go-elasticsearch/v7 v7.6.0 h1:sYpGLpEFHgLUKLsZUBfuaVI9QgHjS3JdH9fX4/z8QI8= github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c h1:onA2RpIyeCPvYAj1LFYiiMTrSpqVINWMfYFRS7lofJs=
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/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 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/jgroeneveld/schema v1.0.0 h1:J0E10CrOkiSEsw6dfb1IfrDJD14pf6QLVJ3tRPl/syI= github.com/jgroeneveld/schema v1.0.0 h1:J0E10CrOkiSEsw6dfb1IfrDJD14pf6QLVJ3tRPl/syI=

View File

@ -6,8 +6,8 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-elasticsearch/v7/esapi" "github.com/elastic/go-elasticsearch/v8/esapi"
) )
// SearchRequest represents a request to ElasticSearch's Search API, described // SearchRequest represents a request to ElasticSearch's Search API, described
@ -26,7 +26,6 @@ type SearchRequest struct {
sort Sort sort Sort
source Source source Source
timeout *time.Duration timeout *time.Duration
} }
// Search creates a new SearchRequest object, to be filled via method chaining. // 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 return req
} }
// Map implements the Mappable interface. It converts the request to into a // Map implements the Mappable interface. It converts the request to into a
// nested map[string]interface{}, as expected by the go-elasticsearch library. // nested map[string]interface{}, as expected by the go-elasticsearch library.
func (req *SearchRequest) Map() map[string]interface{} { func (req *SearchRequest) Map() map[string]interface{} {
@ -155,7 +152,6 @@ func (req *SearchRequest) Map() map[string]interface{} {
m["search_after"] = req.searchAfter m["search_after"] = req.searchAfter
} }
source := req.source.Map() source := req.source.Map()
if len(source) > 0 { if len(source) > 0 {
m["_source"] = source m["_source"] = source