Skip to content

Commit 44cf2df

Browse files
committed
chore: decrease elasticsearch client version from v8 to v7
1 parent 61fce8b commit 44cf2df

File tree

7 files changed

+22
-30
lines changed

7 files changed

+22
-30
lines changed

connector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/Trendyol/go-pq-cdc/logger"
1313
"github.com/Trendyol/go-pq-cdc/pq/message/format"
1414
"github.com/Trendyol/go-pq-cdc/pq/replication"
15-
es "github.com/elastic/go-elasticsearch/v8"
15+
es "github.com/elastic/go-elasticsearch/v7"
1616
"github.com/go-playground/errors"
1717
"github.com/prometheus/client_golang/prometheus"
1818
)

elasticsearch/bulk/bulk.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
"sync"
99
"time"
1010

11+
"github.com/Trendyol/go-pq-cdc/pq/timescaledb"
12+
"github.com/elastic/go-elasticsearch/v7"
13+
1114
"github.com/Trendyol/go-pq-cdc-elasticsearch/config"
1215
elasticsearch2 "github.com/Trendyol/go-pq-cdc-elasticsearch/elasticsearch"
1316
"github.com/Trendyol/go-pq-cdc-elasticsearch/internal/bytes"
@@ -18,9 +21,8 @@ import (
1821

1922
"golang.org/x/sync/errgroup"
2023

21-
"github.com/elastic/go-elasticsearch/v8/esapi"
24+
"github.com/elastic/go-elasticsearch/v7/esapi"
2225

23-
"github.com/elastic/go-elasticsearch/v8"
2426
jsoniter "github.com/json-iterator/go"
2527
)
2628

@@ -339,7 +341,18 @@ func (b *Bulk) getIndexName(tableNamespace, tableName, actionIndexName string) s
339341
return actionIndexName
340342
}
341343

342-
indexName := b.indexMapping[fmt.Sprintf("%s.%s", tableNamespace, tableName)]
344+
fullTableName := fmt.Sprintf("%s.%s", tableNamespace, tableName)
345+
346+
indexName := b.indexMapping[fullTableName]
347+
if indexName != "" {
348+
return indexName
349+
}
350+
351+
t, ok := timescaledb.HyperTables.Load(fullTableName)
352+
if ok {
353+
indexName = b.indexMapping[t.(string)]
354+
}
355+
343356
if indexName == "" {
344357
panic(fmt.Sprintf("there is no index mapping for table: %s.%s on your configuration", tableNamespace, tableName))
345358
}

elasticsearch/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package client
22

33
import (
44
"github.com/Trendyol/go-pq-cdc-elasticsearch/config"
5-
"github.com/elastic/go-elasticsearch/v8"
5+
"github.com/elastic/go-elasticsearch/v7"
66
)
77

88
func NewClient(config *config.Config) (*elasticsearch.Client, error) {

elasticsearch/response_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package elasticsearch
22

33
import (
44
"github.com/Trendyol/go-pq-cdc-elasticsearch/config"
5-
es "github.com/elastic/go-elasticsearch/v8"
5+
es "github.com/elastic/go-elasticsearch/v7"
66
)
77

88
type ResponseHandler interface {

go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ require (
1717
github.com/avast/retry-go/v4 v4.6.0 // indirect
1818
github.com/beorn7/perks v1.0.1 // indirect
1919
github.com/cespare/xxhash/v2 v2.3.0 // indirect
20-
github.com/elastic/elastic-transport-go/v8 v8.6.0 // indirect
21-
github.com/go-logr/logr v1.4.1 // indirect
22-
github.com/go-logr/stdr v1.2.2 // indirect
2320
github.com/jackc/pgpassfile v1.0.0 // indirect
2421
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
2522
github.com/jackc/pgx/v5 v5.6.0 // indirect
@@ -32,9 +29,6 @@ require (
3229
github.com/prometheus/common v0.55.0 // indirect
3330
github.com/prometheus/procfs v0.15.1 // indirect
3431
github.com/valyala/bytebufferpool v1.0.0 // indirect
35-
go.opentelemetry.io/otel v1.24.0 // indirect
36-
go.opentelemetry.io/otel/metric v1.24.0 // indirect
37-
go.opentelemetry.io/otel/trace v1.24.0 // indirect
3832
golang.org/x/crypto v0.24.0 // indirect
3933
golang.org/x/sys v0.21.0 // indirect
4034
golang.org/x/text v0.16.0 // indirect

go.sum

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
1111
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1212
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1313
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14-
github.com/elastic/elastic-transport-go/v8 v8.6.0 h1:Y2S/FBjx1LlCv5m6pWAF2kDJAHoSjSRSJCApolgfthA=
15-
github.com/elastic/elastic-transport-go/v8 v8.6.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
16-
github.com/elastic/go-elasticsearch/v8 v8.14.0 h1:1ywU8WFReLLcxE1WJqii3hTtbPUE2hc38ZK/j4mMFow=
17-
github.com/elastic/go-elasticsearch/v8 v8.14.0/go.mod h1:WRvnlGkSuZyp83M2U8El/LGXpCjYLrvlkSgkAH4O5I4=
18-
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
19-
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
20-
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
21-
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
22-
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
14+
github.com/elastic/go-elasticsearch/v7 v7.17.10 h1:TCQ8i4PmIJuBunvBS6bwT2ybzVFxxUhhltAs3Gyu1yo=
15+
github.com/elastic/go-elasticsearch/v7 v7.17.10/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4=
2316
github.com/go-playground/errors v3.3.0+incompatible h1:w7qP6bdFXNmI86aV8VEfhXrGxoQWYHc/OX4Muw4FgW0=
2417
github.com/go-playground/errors v3.3.0+incompatible/go.mod h1:n+RcthKmtLxDczVHKkhqiUSOGtTjvRl+HB4Gga0vWSI=
2518
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
@@ -71,14 +64,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
7164
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
7265
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
7366
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
74-
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
75-
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
76-
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
77-
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
78-
go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8=
79-
go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E=
80-
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
81-
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
8267
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
8368
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
8469
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=

message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package cdc
22

33
import (
4+
"github.com/elastic/go-elasticsearch/v7"
45
"time"
56

67
"github.com/Trendyol/go-pq-cdc/pq/message/format"
7-
"github.com/elastic/go-elasticsearch/v8"
88
)
99

1010
type Message struct {

0 commit comments

Comments
 (0)