From a4dbd349287bf35b6cdd96eaadbaba921b4d533d Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 14:54:12 +0000 Subject: [PATCH 1/3] chore(deps): update elastic to v9 --- go.mod | 2 +- go.sum | 4 ++-- internal/pkg/api/handleFileDelivery.go | 2 +- internal/pkg/api/handleUpload.go | 2 +- internal/pkg/api/handleUpload_test.go | 2 +- internal/pkg/apikey/apikey.go | 4 ++-- internal/pkg/apikey/apikey_integration_test.go | 2 +- internal/pkg/apikey/auth.go | 4 ++-- internal/pkg/apikey/auth_test.go | 2 +- internal/pkg/apikey/create.go | 4 ++-- internal/pkg/apikey/invalidate.go | 4 ++-- internal/pkg/bulk/engine.go | 4 ++-- internal/pkg/bulk/helpers.go | 2 +- internal/pkg/bulk/opApiKey.go | 2 +- internal/pkg/bulk/opBulk.go | 2 +- internal/pkg/bulk/opRead.go | 2 +- internal/pkg/bulk/opSearch.go | 2 +- internal/pkg/bulk/secret.go | 2 +- internal/pkg/bulk/secret_test.go | 2 +- internal/pkg/bulk/setup_test.go | 2 +- internal/pkg/checkin/bulk.go | 4 ++-- internal/pkg/config/output.go | 2 +- internal/pkg/config/output_test.go | 2 +- internal/pkg/dl/migration.go | 2 +- internal/pkg/es/client.go | 2 +- internal/pkg/es/client_test.go | 2 +- internal/pkg/es/delete.go | 2 +- internal/pkg/es/info.go | 2 +- internal/pkg/file/delivery/delivery.go | 2 +- internal/pkg/file/delivery/delivery_test.go | 2 +- internal/pkg/file/delivery/es.go | 4 ++-- internal/pkg/file/uploader/es.go | 4 ++-- internal/pkg/file/uploader/upload.go | 2 +- internal/pkg/gcheckpt/checkpoint.go | 4 ++-- internal/pkg/monitor/monitor.go | 2 +- internal/pkg/monitor/subscription_monitor.go | 2 +- internal/pkg/server/fleet_integration_test.go | 2 +- internal/pkg/server/fleet_secrets_integration_test.go | 2 +- internal/pkg/server/otel_policy_secrets_integration_test.go | 2 +- internal/pkg/testing/bulk.go | 2 +- internal/pkg/testing/esutil/bootstrap.go | 2 +- internal/pkg/testing/esutil/client.go | 2 +- internal/pkg/testing/esutil/datastream.go | 2 +- internal/pkg/testing/esutil/esutil.go | 2 +- internal/pkg/testing/esutil/ilm.go | 2 +- internal/pkg/testing/esutil/index.go | 2 +- internal/pkg/testing/esutil/template.go | 2 +- internal/pkg/testing/setup.go | 2 +- internal/pkg/ver/check.go | 2 +- testing/go.mod | 4 ++-- 50 files changed, 61 insertions(+), 61 deletions(-) diff --git a/go.mod b/go.mod index 0a1ca3ed0e..8549008e4a 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/elastic/elastic-agent-client/v7 v7.18.1 github.com/elastic/elastic-agent-libs v0.46.2 github.com/elastic/elastic-agent-system-metrics v0.14.4 - github.com/elastic/go-elasticsearch/v8 v8.19.6 + github.com/elastic/go-elasticsearch/v9 v9.5.0 github.com/elastic/go-ucfg v0.9.1 github.com/fxamacker/cbor/v2 v2.9.2 github.com/go-chi/chi/v5 v5.3.1 diff --git a/go.sum b/go.sum index 56712ee984..e103f5f17c 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/elastic/elastic-agent-system-metrics v0.14.4 h1:XGGepNVOxhtfJmanQsgqC github.com/elastic/elastic-agent-system-metrics v0.14.4/go.mod h1:NyNMrdqMfznb/Zy8EmIAHlJpX6HuRlNW+bBL9UN7WQY= github.com/elastic/elastic-transport-go/v8 v8.9.0 h1:KeT/2P54F0xS0S8Y3Pf+tFDg4HmBgReQMB+BMz8dDAs= github.com/elastic/elastic-transport-go/v8 v8.9.0/go.mod h1:ssMTvNS2hwf7CaiGsRRsx4gQHFZ/jS/DkLcISxekWzc= -github.com/elastic/go-elasticsearch/v8 v8.19.6 h1:4qa7ecJkr5rLsoHKIVGbaqcFt2o57CnOHQJi9Pts/rk= -github.com/elastic/go-elasticsearch/v8 v8.19.6/go.mod h1:jeWebApE1oFEW/hKZqx/IRYmP/aa2+WMJkOfk+AduSI= +github.com/elastic/go-elasticsearch/v9 v9.5.0 h1:ye9pnajcrSE2Fra0Q++nJsi09p2dJTaN6YXKz7LL7WU= +github.com/elastic/go-elasticsearch/v9 v9.5.0/go.mod h1:EbZnYlTlbhNqRt98YW+QSM2SEKplN5o8J+G6d9STOVo= github.com/elastic/go-structform v0.0.12 h1:HXpzlAKyej8T7LobqKDThUw7BMhwV6Db24VwxNtgxCs= github.com/elastic/go-structform v0.0.12/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4= github.com/elastic/go-sysinfo v1.15.1 h1:zBmTnFEXxIQ3iwcQuk7MzaUotmKRp3OabbbWM8TdzIQ= diff --git a/internal/pkg/api/handleFileDelivery.go b/internal/pkg/api/handleFileDelivery.go index b49681cfd1..bdc63aab8f 100644 --- a/internal/pkg/api/handleFileDelivery.go +++ b/internal/pkg/api/handleFileDelivery.go @@ -22,7 +22,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/file" "github.com/elastic/fleet-server/v7/internal/pkg/file/delivery" "github.com/elastic/fleet-server/v7/internal/pkg/model" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) var ( diff --git a/internal/pkg/api/handleUpload.go b/internal/pkg/api/handleUpload.go index dbc533dd40..1c9ee825d6 100644 --- a/internal/pkg/api/handleUpload.go +++ b/internal/pkg/api/handleUpload.go @@ -27,7 +27,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/file/cbor" "github.com/elastic/fleet-server/v7/internal/pkg/file/uploader" "github.com/elastic/fleet-server/v7/internal/pkg/model" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) const ( diff --git a/internal/pkg/api/handleUpload_test.go b/internal/pkg/api/handleUpload_test.go index c7a11933fc..89378b5b4f 100644 --- a/internal/pkg/api/handleUpload_test.go +++ b/internal/pkg/api/handleUpload_test.go @@ -31,7 +31,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/file/uploader" "github.com/elastic/fleet-server/v7/internal/pkg/model" itesting "github.com/elastic/fleet-server/v7/internal/pkg/testing" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/pkg/apikey/apikey.go b/internal/pkg/apikey/apikey.go index 0c4fee17e7..198b56c0f3 100644 --- a/internal/pkg/apikey/apikey.go +++ b/internal/pkg/apikey/apikey.go @@ -15,8 +15,8 @@ import ( "strings" "unicode/utf8" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" ) const ( diff --git a/internal/pkg/apikey/apikey_integration_test.go b/internal/pkg/apikey/apikey_integration_test.go index 42f24a4545..5e1a1b6e4a 100644 --- a/internal/pkg/apikey/apikey_integration_test.go +++ b/internal/pkg/apikey/apikey_integration_test.go @@ -12,7 +12,7 @@ import ( testlog "github.com/elastic/fleet-server/v7/internal/pkg/testing/log" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/gofrs/uuid/v5" "github.com/google/go-cmp/cmp" ) diff --git a/internal/pkg/apikey/auth.go b/internal/pkg/apikey/auth.go index af05e0ecd0..37c23c5766 100644 --- a/internal/pkg/apikey/auth.go +++ b/internal/pkg/apikey/auth.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/elastic/fleet-server/v7/internal/pkg/es" ) diff --git a/internal/pkg/apikey/auth_test.go b/internal/pkg/apikey/auth_test.go index 797db557d5..44ebb472e5 100644 --- a/internal/pkg/apikey/auth_test.go +++ b/internal/pkg/apikey/auth_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/elastic/fleet-server/v7/internal/pkg/testing/esutil" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/stretchr/testify/assert" ) diff --git a/internal/pkg/apikey/create.go b/internal/pkg/apikey/create.go index dc5d333f5f..0cc9f825c9 100644 --- a/internal/pkg/apikey/create.go +++ b/internal/pkg/apikey/create.go @@ -10,8 +10,8 @@ import ( "encoding/json" "fmt" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/elastic/fleet-server/v7/internal/pkg/es" ) diff --git a/internal/pkg/apikey/invalidate.go b/internal/pkg/apikey/invalidate.go index cbd651ad97..0479ab6832 100644 --- a/internal/pkg/apikey/invalidate.go +++ b/internal/pkg/apikey/invalidate.go @@ -10,8 +10,8 @@ import ( "encoding/json" "fmt" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/elastic/fleet-server/v7/internal/pkg/es" ) diff --git a/internal/pkg/bulk/engine.go b/internal/pkg/bulk/engine.go index d5723255d6..8e8cd3a0c6 100644 --- a/internal/pkg/bulk/engine.go +++ b/internal/pkg/bulk/engine.go @@ -29,8 +29,8 @@ import ( "go.elastic.co/apm/v2" "golang.org/x/sync/semaphore" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" ) type APIKey = apikey.APIKey diff --git a/internal/pkg/bulk/helpers.go b/internal/pkg/bulk/helpers.go index a5dda37ec4..2b9f5c68ac 100644 --- a/internal/pkg/bulk/helpers.go +++ b/internal/pkg/bulk/helpers.go @@ -10,7 +10,7 @@ import ( "io" "github.com/elastic/fleet-server/v7/internal/pkg/es" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/rs/zerolog" ) diff --git a/internal/pkg/bulk/opApiKey.go b/internal/pkg/bulk/opApiKey.go index f831d5d81b..723e0befba 100644 --- a/internal/pkg/bulk/opApiKey.go +++ b/internal/pkg/bulk/opApiKey.go @@ -12,7 +12,7 @@ import ( "math" "github.com/elastic/fleet-server/v7/internal/pkg/apikey" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/rs/zerolog" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/bulk/opBulk.go b/internal/pkg/bulk/opBulk.go index 437b743a15..e332d532dd 100644 --- a/internal/pkg/bulk/opBulk.go +++ b/internal/pkg/bulk/opBulk.go @@ -11,7 +11,7 @@ import ( "fmt" "time" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/mailru/easyjson" "github.com/rs/zerolog" "go.elastic.co/apm/v2" diff --git a/internal/pkg/bulk/opRead.go b/internal/pkg/bulk/opRead.go index d7a17bd4c3..7b1b00c1f9 100644 --- a/internal/pkg/bulk/opRead.go +++ b/internal/pkg/bulk/opRead.go @@ -10,7 +10,7 @@ import ( "fmt" "time" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/mailru/easyjson" "github.com/rs/zerolog" "go.elastic.co/apm/v2" diff --git a/internal/pkg/bulk/opSearch.go b/internal/pkg/bulk/opSearch.go index 6ed83b6576..5e67061abf 100644 --- a/internal/pkg/bulk/opSearch.go +++ b/internal/pkg/bulk/opSearch.go @@ -13,7 +13,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/es" "github.com/elastic/fleet-server/v7/internal/pkg/sqn" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/mailru/easyjson" "github.com/rs/zerolog" "go.elastic.co/apm/v2" diff --git a/internal/pkg/bulk/secret.go b/internal/pkg/bulk/secret.go index 1110912263..8a00f356ed 100644 --- a/internal/pkg/bulk/secret.go +++ b/internal/pkg/bulk/secret.go @@ -13,7 +13,7 @@ import ( "io" "net/http" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/bulk/secret_test.go b/internal/pkg/bulk/secret_test.go index ec20035984..b12a6a73f7 100644 --- a/internal/pkg/bulk/secret_test.go +++ b/internal/pkg/bulk/secret_test.go @@ -11,7 +11,7 @@ import ( "strings" "testing" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/pkg/bulk/setup_test.go b/internal/pkg/bulk/setup_test.go index 0af0eaa6d1..feca15cb5b 100644 --- a/internal/pkg/bulk/setup_test.go +++ b/internal/pkg/bulk/setup_test.go @@ -15,7 +15,7 @@ import ( "time" "github.com/Pallinder/go-randomdata" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/go-ucfg/yaml" "github.com/rs/xid" diff --git a/internal/pkg/checkin/bulk.go b/internal/pkg/checkin/bulk.go index 3be9d94188..32810a86c9 100644 --- a/internal/pkg/checkin/bulk.go +++ b/internal/pkg/checkin/bulk.go @@ -20,8 +20,8 @@ import ( "github.com/rs/zerolog" - estypes "github.com/elastic/go-elasticsearch/v8/typedapi/types" - "github.com/elastic/go-elasticsearch/v8/typedapi/types/enums/scriptlanguage" + estypes "github.com/elastic/go-elasticsearch/v9/typedapi/types" + "github.com/elastic/go-elasticsearch/v9/typedapi/types/enums/scriptlanguage" ) const defaultFlushInterval = 10 * time.Second diff --git a/internal/pkg/config/output.go b/internal/pkg/config/output.go index 277f41a477..6acaed8cf1 100644 --- a/internal/pkg/config/output.go +++ b/internal/pkg/config/output.go @@ -22,7 +22,7 @@ import ( "github.com/elastic/elastic-agent-libs/transport/tlscommon" "github.com/elastic/fleet-server/v7/internal/pkg/logger/zap" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/rs/zerolog" ) diff --git a/internal/pkg/config/output_test.go b/internal/pkg/config/output_test.go index 566340fbbd..c41690fc1c 100644 --- a/internal/pkg/config/output_test.go +++ b/internal/pkg/config/output_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/elastic-agent-libs/transport/tlscommon" ) diff --git a/internal/pkg/dl/migration.go b/internal/pkg/dl/migration.go index 5f39b2d6c2..13fedfd369 100644 --- a/internal/pkg/dl/migration.go +++ b/internal/pkg/dl/migration.go @@ -12,7 +12,7 @@ import ( "net/http" "time" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/rs/zerolog" "github.com/elastic/fleet-server/v7/internal/pkg/bulk" diff --git a/internal/pkg/es/client.go b/internal/pkg/es/client.go index 3e75fcf5ec..a08ef1d739 100644 --- a/internal/pkg/es/client.go +++ b/internal/pkg/es/client.go @@ -22,7 +22,7 @@ import ( "github.com/rs/zerolog" backoff "github.com/cenkalti/backoff/v4" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) const ( diff --git a/internal/pkg/es/client_test.go b/internal/pkg/es/client_test.go index c677a5dec4..a2cc88eb4d 100644 --- a/internal/pkg/es/client_test.go +++ b/internal/pkg/es/client_test.go @@ -24,7 +24,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/testing/certs" "github.com/stretchr/testify/require" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) var enabled bool = true diff --git a/internal/pkg/es/delete.go b/internal/pkg/es/delete.go index 54014c6e4f..4f1cb8a2ce 100644 --- a/internal/pkg/es/delete.go +++ b/internal/pkg/es/delete.go @@ -8,7 +8,7 @@ import ( "context" "encoding/json" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) func DeleteIndices(ctx context.Context, es *elasticsearch.Client, indices []string) error { diff --git a/internal/pkg/es/info.go b/internal/pkg/es/info.go index 99de8c1e29..a0aa924088 100644 --- a/internal/pkg/es/info.go +++ b/internal/pkg/es/info.go @@ -9,7 +9,7 @@ import ( "encoding/json" "strings" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) type versionInfo struct { diff --git a/internal/pkg/file/delivery/delivery.go b/internal/pkg/file/delivery/delivery.go index 715bbfd911..ffbbc96de3 100644 --- a/internal/pkg/file/delivery/delivery.go +++ b/internal/pkg/file/delivery/delivery.go @@ -15,7 +15,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/bulk" "github.com/elastic/fleet-server/v7/internal/pkg/file" "github.com/elastic/fleet-server/v7/internal/pkg/file/cbor" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/rs/zerolog" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/file/delivery/delivery_test.go b/internal/pkg/file/delivery/delivery_test.go index 4bbbb0bdf8..c6a47b4be6 100644 --- a/internal/pkg/file/delivery/delivery_test.go +++ b/internal/pkg/file/delivery/delivery_test.go @@ -20,7 +20,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/es" "github.com/elastic/fleet-server/v7/internal/pkg/file" itesting "github.com/elastic/fleet-server/v7/internal/pkg/testing" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/rs/zerolog" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/pkg/file/delivery/es.go b/internal/pkg/file/delivery/es.go index 78bc66c16a..1b96ae903c 100644 --- a/internal/pkg/file/delivery/es.go +++ b/internal/pkg/file/delivery/es.go @@ -14,8 +14,8 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/dsl" "github.com/elastic/fleet-server/v7/internal/pkg/es" "github.com/elastic/fleet-server/v7/internal/pkg/file" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/file/uploader/es.go b/internal/pkg/file/uploader/es.go index 5c85340c9f..45407e0f23 100644 --- a/internal/pkg/file/uploader/es.go +++ b/internal/pkg/file/uploader/es.go @@ -16,8 +16,8 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/es" "github.com/elastic/fleet-server/v7/internal/pkg/file" "github.com/elastic/fleet-server/v7/internal/pkg/file/cbor" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" "github.com/rs/zerolog" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/file/uploader/upload.go b/internal/pkg/file/uploader/upload.go index 6732a184d0..8c2880d0b8 100644 --- a/internal/pkg/file/uploader/upload.go +++ b/internal/pkg/file/uploader/upload.go @@ -15,7 +15,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/bulk" "github.com/elastic/fleet-server/v7/internal/pkg/cache" "github.com/elastic/fleet-server/v7/internal/pkg/file" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/gofrs/uuid/v5" "go.elastic.co/apm/v2" ) diff --git a/internal/pkg/gcheckpt/checkpoint.go b/internal/pkg/gcheckpt/checkpoint.go index 6f0fc1164b..fe57447f1a 100644 --- a/internal/pkg/gcheckpt/checkpoint.go +++ b/internal/pkg/gcheckpt/checkpoint.go @@ -18,8 +18,8 @@ import ( esh "github.com/elastic/fleet-server/v7/internal/pkg/es" "github.com/elastic/fleet-server/v7/internal/pkg/sqn" - "github.com/elastic/go-elasticsearch/v8" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9" + "github.com/elastic/go-elasticsearch/v9/esapi" ) var ErrGlobalCheckpoint = errors.New("global checkpoint error") diff --git a/internal/pkg/monitor/monitor.go b/internal/pkg/monitor/monitor.go index e37e7f5e13..9663f0ae45 100644 --- a/internal/pkg/monitor/monitor.go +++ b/internal/pkg/monitor/monitor.go @@ -24,7 +24,7 @@ import ( "github.com/rs/zerolog" "go.elastic.co/apm/v2" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) const ( diff --git a/internal/pkg/monitor/subscription_monitor.go b/internal/pkg/monitor/subscription_monitor.go index eda62894f4..7535b6a932 100644 --- a/internal/pkg/monitor/subscription_monitor.go +++ b/internal/pkg/monitor/subscription_monitor.go @@ -14,7 +14,7 @@ import ( "github.com/elastic/fleet-server/v7/internal/pkg/sqn" "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "golang.org/x/sync/errgroup" ) diff --git a/internal/pkg/server/fleet_integration_test.go b/internal/pkg/server/fleet_integration_test.go index b34d9b1587..8917239dec 100644 --- a/internal/pkg/server/fleet_integration_test.go +++ b/internal/pkg/server/fleet_integration_test.go @@ -33,7 +33,7 @@ import ( "golang.org/x/sync/errgroup" "github.com/elastic/elastic-agent-client/v7/pkg/client" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/fleet-server/v7/internal/pkg/api" "github.com/elastic/fleet-server/v7/internal/pkg/apikey" diff --git a/internal/pkg/server/fleet_secrets_integration_test.go b/internal/pkg/server/fleet_secrets_integration_test.go index 96c71a512e..928d095d7c 100644 --- a/internal/pkg/server/fleet_secrets_integration_test.go +++ b/internal/pkg/server/fleet_secrets_integration_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/fleet-server/v7/internal/pkg/api" "github.com/elastic/fleet-server/v7/internal/pkg/apikey" diff --git a/internal/pkg/server/otel_policy_secrets_integration_test.go b/internal/pkg/server/otel_policy_secrets_integration_test.go index 95ca09324b..3a5659dbf7 100644 --- a/internal/pkg/server/otel_policy_secrets_integration_test.go +++ b/internal/pkg/server/otel_policy_secrets_integration_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/fleet-server/v7/internal/pkg/api" "github.com/elastic/fleet-server/v7/internal/pkg/apikey" diff --git a/internal/pkg/testing/bulk.go b/internal/pkg/testing/bulk.go index f890b7b16b..8a5b6bb778 100644 --- a/internal/pkg/testing/bulk.go +++ b/internal/pkg/testing/bulk.go @@ -7,7 +7,7 @@ package testing import ( "context" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/rs/zerolog" "github.com/stretchr/testify/mock" "go.elastic.co/apm/v2" diff --git a/internal/pkg/testing/esutil/bootstrap.go b/internal/pkg/testing/esutil/bootstrap.go index c5bf60f001..f2e446869c 100644 --- a/internal/pkg/testing/esutil/bootstrap.go +++ b/internal/pkg/testing/esutil/bootstrap.go @@ -7,7 +7,7 @@ package esutil import ( "context" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) // EnsureIndex sets up the index if it doesn't exist. It's utilized for integration tests at the moment. diff --git a/internal/pkg/testing/esutil/client.go b/internal/pkg/testing/esutil/client.go index 5fbbdc33ae..7e636fbc4c 100644 --- a/internal/pkg/testing/esutil/client.go +++ b/internal/pkg/testing/esutil/client.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/stretchr/testify/require" ) diff --git a/internal/pkg/testing/esutil/datastream.go b/internal/pkg/testing/esutil/datastream.go index 7fb1fb61fa..442f60cc68 100644 --- a/internal/pkg/testing/esutil/datastream.go +++ b/internal/pkg/testing/esutil/datastream.go @@ -12,7 +12,7 @@ import ( "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) func CreateDatastream(ctx context.Context, cli *elasticsearch.Client, name string) error { diff --git a/internal/pkg/testing/esutil/esutil.go b/internal/pkg/testing/esutil/esutil.go index e4a5949846..77f76be0f3 100644 --- a/internal/pkg/testing/esutil/esutil.go +++ b/internal/pkg/testing/esutil/esutil.go @@ -14,7 +14,7 @@ import ( "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8/esapi" + "github.com/elastic/go-elasticsearch/v9/esapi" ) const ( diff --git a/internal/pkg/testing/esutil/ilm.go b/internal/pkg/testing/esutil/ilm.go index 817b0d2866..37bf514930 100644 --- a/internal/pkg/testing/esutil/ilm.go +++ b/internal/pkg/testing/esutil/ilm.go @@ -14,7 +14,7 @@ import ( "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) // Can be cleaner but it's temporary bootstrap until it's moved to the elasticseach system index plugin diff --git a/internal/pkg/testing/esutil/index.go b/internal/pkg/testing/esutil/index.go index 8164c603e5..777d454ec1 100644 --- a/internal/pkg/testing/esutil/index.go +++ b/internal/pkg/testing/esutil/index.go @@ -12,7 +12,7 @@ import ( "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) func CreateIndex(ctx context.Context, cli *elasticsearch.Client, name string) error { diff --git a/internal/pkg/testing/esutil/template.go b/internal/pkg/testing/esutil/template.go index 93db2585f0..8f2221d198 100644 --- a/internal/pkg/testing/esutil/template.go +++ b/internal/pkg/testing/esutil/template.go @@ -14,7 +14,7 @@ import ( "github.com/rs/zerolog" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) const ( diff --git a/internal/pkg/testing/setup.go b/internal/pkg/testing/setup.go index f011691484..d4c1773e12 100644 --- a/internal/pkg/testing/setup.go +++ b/internal/pkg/testing/setup.go @@ -13,7 +13,7 @@ import ( "errors" "testing" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/elastic/go-ucfg/yaml" "github.com/rs/xid" diff --git a/internal/pkg/ver/check.go b/internal/pkg/ver/check.go index ec4eb263b8..c2fc4d9bd9 100644 --- a/internal/pkg/ver/check.go +++ b/internal/pkg/ver/check.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/go-version" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" ) // Variables to define errors when comparing versions. diff --git a/testing/go.mod b/testing/go.mod index 3e59726ac4..b3feceec38 100644 --- a/testing/go.mod +++ b/testing/go.mod @@ -11,8 +11,8 @@ require ( github.com/Shopify/toxiproxy/v2 v2.12.0 github.com/elastic/elastic-agent-client/v7 v7.18.1 github.com/elastic/elastic-agent-libs v0.46.2 - github.com/elastic/fleet-server/pkg/api v0.0.0-00010101000000-000000000000 - github.com/elastic/fleet-server/v7 v7.0.0-00010101000000-000000000000 + github.com/elastic/fleet-server/pkg/api/v9 v9.5.0 + github.com/elastic/fleet-server/v9 v9.5.0 github.com/gofrs/uuid/v5 v5.5.0 github.com/moby/moby/api v1.55.0 github.com/stretchr/testify v1.11.1 From b8dc5d27760bd4187fe4f45dd8e9eedd3a768115 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 11 Aug 2026 15:55:22 -0700 Subject: [PATCH 2/3] fix: support go-elasticsearch v9 API --- .golangci.yml | 7 +++++++ NOTICE-fips.txt | 6 +++--- NOTICE.txt | 6 +++--- internal/pkg/bulk/secret_limit_test.go | 2 +- internal/pkg/monitor/monitor.go | 2 +- internal/pkg/testing/esutil/ilm.go | 5 +++-- testing/go.mod | 4 ++-- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 104cf923ce..f94c70575a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -152,6 +152,13 @@ linters: - common-false-positives - legacy - std-error-handling + rules: + # go-elasticsearch v9 keeps the legacy Config/NewClient API fully + # functional. Fleet Server still relies on that API while the option-based + # client configuration is migrated separately. + - linters: + - staticcheck + text: "SA1019: elasticsearch\\.(Config|NewClient) is deprecated" # Which file paths to exclude: they will be analyzed, but issues from them won't be reported. # "/" will be replaced by the current OS file path separator to properly work on Windows. # Default: [] diff --git a/NOTICE-fips.txt b/NOTICE-fips.txt index 0dc504cc12..159fac5d06 100644 --- a/NOTICE-fips.txt +++ b/NOTICE-fips.txt @@ -1082,12 +1082,12 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-s -------------------------------------------------------------------------------- -Dependency : github.com/elastic/go-elasticsearch/v8 -Version: v8.19.6 +Dependency : github.com/elastic/go-elasticsearch/v9 +Version: v9.5.0 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/go-elasticsearch/v8@v8.19.6/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/go-elasticsearch/v9@v9.5.0/LICENSE: Apache License Version 2.0, January 2004 diff --git a/NOTICE.txt b/NOTICE.txt index b178d4310c..a30fea7a77 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1082,12 +1082,12 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-s -------------------------------------------------------------------------------- -Dependency : github.com/elastic/go-elasticsearch/v8 -Version: v8.19.6 +Dependency : github.com/elastic/go-elasticsearch/v9 +Version: v9.5.0 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/go-elasticsearch/v8@v8.19.6/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/go-elasticsearch/v9@v9.5.0/LICENSE: Apache License Version 2.0, January 2004 diff --git a/internal/pkg/bulk/secret_limit_test.go b/internal/pkg/bulk/secret_limit_test.go index 24a62d7dae..7d20bf0a74 100644 --- a/internal/pkg/bulk/secret_limit_test.go +++ b/internal/pkg/bulk/secret_limit_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/elastic/go-elasticsearch/v8" + "github.com/elastic/go-elasticsearch/v9" "github.com/stretchr/testify/require" ) diff --git a/internal/pkg/monitor/monitor.go b/internal/pkg/monitor/monitor.go index 9663f0ae45..0ac5911fe1 100644 --- a/internal/pkg/monitor/monitor.go +++ b/internal/pkg/monitor/monitor.go @@ -418,8 +418,8 @@ func (m *simpleMonitorT) search(ctx context.Context, tmpl *dsl.Tmpl, params map[ res, err := m.esCli.FleetSearch( m.index, + bytes.NewBuffer(query), m.esCli.FleetSearch.WithContext(ctx), - m.esCli.FleetSearch.WithBody(bytes.NewBuffer(query)), m.esCli.FleetSearch.WithWaitForCheckpoints(seqNos.String()), ) if err != nil { diff --git a/internal/pkg/testing/esutil/ilm.go b/internal/pkg/testing/esutil/ilm.go index 37bf514930..6ffad67b0a 100644 --- a/internal/pkg/testing/esutil/ilm.go +++ b/internal/pkg/testing/esutil/ilm.go @@ -150,8 +150,9 @@ func createILMPolicy(ctx context.Context, cli *elasticsearch.Client, name string // in that case let's just create the ILM policy zerolog.Ctx(ctx).Debug().Str("policy", policy).Str("body", body).Msg("Creating ILM policy") - res, err := cli.ILM.PutLifecycle(policy, - cli.ILM.PutLifecycle.WithBody(strings.NewReader(body)), + res, err := cli.ILM.PutLifecycle( + strings.NewReader(body), + policy, cli.ILM.PutLifecycle.WithContext(ctx), ) if err != nil { diff --git a/testing/go.mod b/testing/go.mod index b3feceec38..3e59726ac4 100644 --- a/testing/go.mod +++ b/testing/go.mod @@ -11,8 +11,8 @@ require ( github.com/Shopify/toxiproxy/v2 v2.12.0 github.com/elastic/elastic-agent-client/v7 v7.18.1 github.com/elastic/elastic-agent-libs v0.46.2 - github.com/elastic/fleet-server/pkg/api/v9 v9.5.0 - github.com/elastic/fleet-server/v9 v9.5.0 + github.com/elastic/fleet-server/pkg/api v0.0.0-00010101000000-000000000000 + github.com/elastic/fleet-server/v7 v7.0.0-00010101000000-000000000000 github.com/gofrs/uuid/v5 v5.5.0 github.com/moby/moby/api v1.55.0 github.com/stretchr/testify v1.11.1 From 4521726c1acb30e8158132cc7617260af073a111 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 11 Aug 2026 16:05:39 -0700 Subject: [PATCH 3/3] chore: fix lint issues in migrated files --- internal/pkg/config/output.go | 4 +-- internal/pkg/monitor/monitor.go | 26 +++++++++---------- internal/pkg/server/fleet_integration_test.go | 5 ++-- internal/pkg/testing/setup.go | 6 ++--- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/internal/pkg/config/output.go b/internal/pkg/config/output.go index 6acaed8cf1..27681c0196 100644 --- a/internal/pkg/config/output.go +++ b/internal/pkg/config/output.go @@ -261,13 +261,13 @@ func (c *Elasticsearch) DiagRequests(ctx context.Context) []byte { hostURL, err := makeURL(c.Protocol, "", host, 9200) if err != nil { zerolog.Ctx(ctx).Warn().Err(err).Str("host", host).Msg("Unable to transform host to url.URL") - res.WriteString(fmt.Sprintf("Unable to transform host %q to url.URL: %v\n", host, err)) + fmt.Fprintf(&res, "Unable to transform host %q to url.URL: %v\n", host, err) continue } req, err := http.NewRequestWithContext(ctx, http.MethodGet, hostURL, nil) if err != nil { zerolog.Ctx(ctx).Warn().Err(err).Str("host", host).Msg("Unable to create request to host") - res.WriteString(fmt.Sprintf("Unable to create request to host %q: %v\n", host, err)) + fmt.Fprintf(&res, "Unable to create request to host %q: %v\n", host, err) continue } req.Header = headers.Clone() diff --git a/internal/pkg/monitor/monitor.go b/internal/pkg/monitor/monitor.go index 0ac5911fe1..342eda4d2d 100644 --- a/internal/pkg/monitor/monitor.go +++ b/internal/pkg/monitor/monitor.go @@ -101,7 +101,7 @@ type simpleMonitorT struct { } // Option is a functional configuration option. -type Option func(SimpleMonitor) +type Option func(*simpleMonitorT) // NewSimple creates new SimpleMonitor. func NewSimple(index string, esCli, monCli *elasticsearch.Client, opts ...Option) (SimpleMonitor, error) { @@ -139,43 +139,43 @@ func NewSimple(index string, esCli, monCli *elasticsearch.Client, opts ...Option // WithFetchSize sets the fetch size of the monitor. func WithFetchSize(fetchSize int) Option { - return func(m SimpleMonitor) { + return func(m *simpleMonitorT) { if fetchSize > 0 { - m.(*simpleMonitorT).fetchSize = fetchSize + m.fetchSize = fetchSize } } } // WithPollTimeout sets the global checkpoint polling timeout func WithPollTimeout(to time.Duration) Option { - return func(m SimpleMonitor) { - m.(*simpleMonitorT).pollTimeout = to + return func(m *simpleMonitorT) { + m.pollTimeout = to } } // WithExpiration adds the expiration field to the monitor query. func WithExpiration(withExpiration bool) Option { - return func(m SimpleMonitor) { - m.(*simpleMonitorT).withExpiration = withExpiration + return func(m *simpleMonitorT) { + m.withExpiration = withExpiration } } // WithReadyChan allows to pass the channel that will signal when monitor is ready. func WithReadyChan(readyCh chan error) Option { - return func(m SimpleMonitor) { - m.(*simpleMonitorT).readyCh = readyCh + return func(m *simpleMonitorT) { + m.readyCh = readyCh } } func WithAPMTracer(tracer *apm.Tracer) Option { - return func(m SimpleMonitor) { - m.(*simpleMonitorT).tracer = tracer + return func(m *simpleMonitorT) { + m.tracer = tracer } } func WithDebounceTime(dur time.Duration) Option { - return func(m SimpleMonitor) { - m.(*simpleMonitorT).debounceTime = dur + return func(m *simpleMonitorT) { + m.debounceTime = dur } } diff --git a/internal/pkg/server/fleet_integration_test.go b/internal/pkg/server/fleet_integration_test.go index 8917239dec..012a8d9dc6 100644 --- a/internal/pkg/server/fleet_integration_test.go +++ b/internal/pkg/server/fleet_integration_test.go @@ -436,9 +436,8 @@ func TestServerUnauthorized(t *testing.T) { srv.buildURL(agentID, "acks"), } - allurls := []string{ - srv.buildURL("", "enroll"), - } + allurls := make([]string, 0, 1+len(agenturls)) + allurls = append(allurls, srv.buildURL("", "enroll")) allurls = append(allurls, agenturls...) // Expecting no authorization header error diff --git a/internal/pkg/testing/setup.go b/internal/pkg/testing/setup.go index d4c1773e12..b2113e2725 100644 --- a/internal/pkg/testing/setup.go +++ b/internal/pkg/testing/setup.go @@ -109,9 +109,9 @@ func CleanIndex(ctx context.Context, t *testing.T, bulker bulk.Bulk, index strin cli := bulker.Client() - res, err := cli.API.DeleteByQuery([]string{index}, bytes.NewReader(query), - cli.API.DeleteByQuery.WithContext(ctx), - cli.API.DeleteByQuery.WithRefresh(true), + res, err := cli.DeleteByQuery([]string{index}, bytes.NewReader(query), + cli.DeleteByQuery.WithContext(ctx), + cli.DeleteByQuery.WithRefresh(true), ) if err != nil { t.Fatalf("could not clean index %s, DeleteByQuery failed: %v",