diff --git a/count.go b/count.go index e8dc60f..186d787 100644 --- a/count.go +++ b/count.go @@ -9,6 +9,7 @@ import ( "context" "encoding/json" "fmt" + "net/http" opensearch "github.com/opensearch-project/opensearch-go/v4" opensearchapi "github.com/opensearch-project/opensearch-go/v4/opensearchapi" @@ -64,7 +65,7 @@ func (req *CountRequest) Run( var searchResp opensearchapi.SearchResp // Execute the search request using the OpenSearch client's Do method - if _, err := client.Do(ctx, searchReq, &searchResp); err != nil { + if _, err := client.Do(ctx, http.MethodPost, searchReq, &searchResp); err != nil { return nil, fmt.Errorf("search request failed: %w", err) } diff --git a/delete.go b/delete.go index ed79715..2ce21d5 100644 --- a/delete.go +++ b/delete.go @@ -9,6 +9,7 @@ import ( "context" "encoding/json" "fmt" + "net/http" opensearch "github.com/opensearch-project/opensearch-go/v4" opensearchapi "github.com/opensearch-project/opensearch-go/v4/opensearchapi" @@ -65,7 +66,7 @@ func (req *DeleteRequest) Run( var deleteResp opensearchapi.DocumentDeleteByQueryResp // Execute the delete request using the OpenSearch client's Do method - if _, err := client.Do(ctx, deleteReq, &deleteResp); err != nil { + if _, err := client.Do(ctx, http.MethodPost, deleteReq, &deleteResp); err != nil { return nil, fmt.Errorf("delete request failed: %w", err) } diff --git a/go.mod b/go.mod index cb8889b..791b4a7 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,14 @@ module github.com/defensestation/osquery/v2 -go 1.22.1 +go 1.25.9 require ( github.com/fatih/structs v1.1.0 github.com/jgroeneveld/trial v2.0.0+incompatible - github.com/opensearch-project/opensearch-go/v4 v4.3.0 + github.com/opensearch-project/opensearch-go/v4 v4.7.3 ) -require github.com/jgroeneveld/schema v1.0.0 // indirect +require ( + github.com/jgroeneveld/schema v1.0.0 // indirect + golang.org/x/sync v0.22.0 // indirect +) diff --git a/go.sum b/go.sum index 4d7fef7..af9dad8 100644 --- a/go.sum +++ b/go.sum @@ -6,21 +6,25 @@ github.com/jgroeneveld/schema v1.0.0 h1:J0E10CrOkiSEsw6dfb1IfrDJD14pf6QLVJ3tRPl/ github.com/jgroeneveld/schema v1.0.0/go.mod h1:M14lv7sNMtGvo3ops1MwslaSYgDYxrSmbzWIQ0Mr5rs= github.com/jgroeneveld/trial v2.0.0+incompatible h1:d59ctdgor+VqdZCAiUfVN8K13s0ALDioG5DWwZNtRuQ= github.com/jgroeneveld/trial v2.0.0+incompatible/go.mod h1:I6INLW96EN8WysNBXUFI3M4RIC8ePg9ntAc/Wy+U/+M= -github.com/opensearch-project/opensearch-go/v4 v4.3.0 h1:gmQ+ILFJW6AJimivf+lHGVqCS2SCr/PBBf2Qr1xOCgE= -github.com/opensearch-project/opensearch-go/v4 v4.3.0/go.mod h1:+w6KAvEX3S0fVVmZciNLN0CkXhxxem26+F6Y7DoPp04= +github.com/opensearch-project/opensearch-go/v4 v4.7.3 h1:JzETy7bYnnSDj4gueUh8t4EYBhs9rhKsgeVsoul77rA= +github.com/opensearch-project/opensearch-go/v4 v4.7.3/go.mod h1:+iikkyLrVC8ZvyfKv2sua1Ze1LbpWL7eZe4IkHqNGtg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= -github.com/wI2L/jsondiff v0.6.0 h1:zrsH3FbfVa3JO9llxrcDy/XLkYPLgoMX6Mz3T2PP2AI= -github.com/wI2L/jsondiff v0.6.0/go.mod h1:D6aQ5gKgPF9g17j+E9N7aasmU1O+XvfmWm1y8UMmNpw= +github.com/wI2L/jsondiff v0.7.1 h1:Fg9+yj+1/x3UtPBJhR91TKEzRkrEEWcAcLbg9dzEaNM= +github.com/wI2L/jsondiff v0.7.1/go.mod h1:yAt2W7U6Jd4HK0RA8DGSGk0zDtfEtOUUJVnH/xICpjo= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/search.go b/search.go index 68fd329..0f03e0b 100644 --- a/search.go +++ b/search.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "net/http" "time" "github.com/opensearch-project/opensearch-go/v4" @@ -211,7 +212,7 @@ func (req *SearchRequest) Run( var searchResp opensearchapi.SearchResp // Execute the search request using the OpenSearch client's Do method - if _, err := client.Do(ctx, searchReq, &searchResp); err != nil { + if _, err := client.Do(ctx, http.MethodPost, searchReq, &searchResp); err != nil { return nil, fmt.Errorf("search request failed: %w", err) }