Skip to content

Commit

Permalink
Add typeName to es config and upgrade Go 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmtszr committed Mar 31, 2023
1 parent 53bebd2 commit e473192
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20

- name: Install dependencies
run: go get .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
go-version: 1.20

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine as builder
FROM golang:1.20-alpine as builder

WORKDIR /project

Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

type Elasticsearch struct {
CollectionIndexMapping map[string]string `yaml:"collectionIndexMapping"`
TypeName string `yaml:"typeName"`
Urls []string `yaml:"urls"`
BulkSize int `yaml:"bulkSize"`
BulkTickerDuration time.Duration `yaml:"bulkTickerDuration"`
Expand Down
6 changes: 4 additions & 2 deletions elasticsearch/bulk/bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import (
type Bulk struct {
errorLogger logger.Logger
logger logger.Logger
esClient *elasticsearch.Client
dcpCheckpointCommit func()
batchTicker *time.Ticker
isClosed chan bool
actionCh chan document.ESActionDocument
dcpCheckpointCommit func()
esClient *elasticsearch.Client
collectionIndexMapping map[string]string
typeName string
batch []byte
batchSize int
batchLimit int
Expand Down Expand Up @@ -53,6 +54,7 @@ func NewBulk(
dcpCheckpointCommit: dcpCheckpointCommit,
esClient: esClient,
collectionIndexMapping: esConfig.CollectionIndexMapping,
typeName: esConfig.TypeName,
}
go bulk.StartBulk()
return bulk, nil
Expand Down
1 change: 1 addition & 0 deletions example/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dcp:
memberNumber: 1
totalMembers: 1
elasticsearch:
typeName: _doc
collectionIndexMapping:
_default: indexname
urls:
Expand Down
30 changes: 18 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
module github.com/Trendyol/go-elasticsearch-connect-couchbase

go 1.19
go 1.20

require (
github.com/Trendyol/go-dcp-client v0.0.42
github.com/elastic/go-elasticsearch/v7 v7.17.7
github.com/gookit/config/v2 v2.1.8
github.com/valyala/fasthttp v1.40.0
github.com/gookit/config/v2 v2.2.1
github.com/valyala/fasthttp v1.45.0
)

require (
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/ansrivas/fiberprometheus/v2 v2.4.1 // indirect
github.com/avast/retry-go/v4 v4.3.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/couchbase/gocbcore/v10 v10.2.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/goccy/go-yaml v1.10.0 // indirect
github.com/gofiber/adaptor/v2 v2.1.25 // indirect
github.com/gofiber/fiber/v2 v2.39.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/gookit/goutil v0.5.15 // indirect
github.com/gookit/color v1.5.2 // indirect
github.com/gookit/goutil v0.6.6 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -46,12 +49,15 @@ require (
github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
Loading

0 comments on commit e473192

Please sign in to comment.