Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/elasticindexer/config/prefs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
acknowledge-timeout-in-seconds = 50

[config.elastic-cluster]
use-kibana = false
url = "http://localhost:9200"
username = ""
password = ""
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0
github.com/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273
github.com/multiversx/mx-chain-vm-common-go v1.5.17-0.20250520075408-c94bee9ee163
github.com/prometheus/client_model v0.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476 h1:Dn73bH1AdG+7+3/FFRfOiivOEvwPyzZUBWWxpk8QVxc=
github.com/multiversx/mx-chain-communication-go v1.2.1-0.20250520083403-3f2bad6d5476/go.mod h1:99+FW6f7X0Ri5tph+2l2GaDVrdej1do89exkfh7gilE=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a h1:dhCobNEcBdvutX+0UYF/l86oLVO9iUiUeF3sLFa9qhE=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250520074139-18b645ad397a/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39 h1:a+98PN1XXTCYiJEdg7gpqfTOxGuQqvA8H1yglidV/p0=
github.com/multiversx/mx-chain-core-go v1.3.2-0.20250602142114-cb1013453d39/go.mod h1:IO+vspNan+gT0WOHnJ95uvWygiziHZvfXpff6KnxV7g=
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d h1:NI5uKpkwP5XZu9gtDiWxmbbb07T9hXegPist17WAzY4=
github.com/multiversx/mx-chain-crypto-go v1.2.13-0.20250520075055-8ab2a164945d/go.mod h1:yekQt4uB5LYXtimbhpdUbnFexjucWrQG/t+AX55bdM8=
github.com/multiversx/mx-chain-logger-go v1.0.16-0.20250520074859-b2faf3c90273 h1:1I2CgGDAMINxrKI6yzSP/Y6Wow2YUmqegUXcltpGXQA=
Expand Down
13 changes: 2 additions & 11 deletions process/elasticproc/elasticProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewElasticProcessor(arguments *ArgElasticProcessor) (*elasticProcessor, err
bulkRequestMaxSize: arguments.BulkRequestMaxSize,
}

err = ei.init(arguments.UseKibana, arguments.IndexTemplates, arguments.IndexPolicies, arguments.ExtraMappings)
err = ei.init(arguments.IndexTemplates, arguments.IndexPolicies, arguments.ExtraMappings)
if err != nil {
return nil, err
}
Expand All @@ -107,21 +107,12 @@ func NewElasticProcessor(arguments *ArgElasticProcessor) (*elasticProcessor, err
}

// TODO move all the index create part in a new component
func (ei *elasticProcessor) init(useKibana bool, indexTemplates, _ map[string]*bytes.Buffer, extraMappings []templates.ExtraMapping) error {
func (ei *elasticProcessor) init(indexTemplates, _ map[string]*bytes.Buffer, extraMappings []templates.ExtraMapping) error {
err := ei.createOpenDistroTemplates(indexTemplates)
if err != nil {
return err
}

//nolint
if useKibana {
// TODO: Re-activate after we think of a solid way to handle forks+rotating indexes
// err = ei.createIndexPolicies(indexPolicies)
// if err != nil {
// return err
// }
}

err = ei.createIndexTemplates(indexTemplates)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion process/elasticproc/factory/elasticProcessorFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type ArgElasticProcessorFactory struct {

// CreateElasticProcessor will create a new instance of ElasticProcessor
func CreateElasticProcessor(arguments ArgElasticProcessorFactory) (dataindexer.ElasticProcessor, error) {
templatesAndPoliciesReader := templatesAndPolicies.CreateTemplatesAndPoliciesReader(arguments.UseKibana)
templatesAndPoliciesReader := templatesAndPolicies.NewTemplatesAndPolicyReader()
indexTemplates, indexPolicies, err := templatesAndPoliciesReader.GetElasticTemplatesAndPolicies()
if err != nil {
return nil, err
Expand Down
53 changes: 0 additions & 53 deletions process/elasticproc/templatesAndPolicies/noKibana.go

This file was deleted.

53 changes: 53 additions & 0 deletions process/elasticproc/templatesAndPolicies/reader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package templatesAndPolicies

import (
"bytes"

indexer "github.com/multiversx/mx-chain-es-indexer-go/process/dataindexer"
"github.com/multiversx/mx-chain-es-indexer-go/templates"
"github.com/multiversx/mx-chain-es-indexer-go/templates/indices"
)

type templatesAndPolicyReader struct{}

// NewTemplatesAndPolicyReader will create a new instance of templatesAndPolicyReader
func NewTemplatesAndPolicyReader() *templatesAndPolicyReader {
return new(templatesAndPolicyReader)
}

// GetElasticTemplatesAndPolicies will return templates and policies
func (tr *templatesAndPolicyReader) GetElasticTemplatesAndPolicies() (map[string]*bytes.Buffer, map[string]*bytes.Buffer, error) {
indexPolicies := make(map[string]*bytes.Buffer)
indexTemplates := make(map[string]*bytes.Buffer)

indexTemplates["opendistro"] = indices.OpenDistro.ToBuffer()
indexTemplates[indexer.TransactionsIndex] = indices.Transactions.ToBuffer()
indexTemplates[indexer.BlockIndex] = indices.Blocks.ToBuffer()
indexTemplates[indexer.MiniblocksIndex] = indices.Miniblocks.ToBuffer()
indexTemplates[indexer.RatingIndex] = indices.Rating.ToBuffer()
indexTemplates[indexer.RoundsIndex] = indices.Rounds.ToBuffer()
indexTemplates[indexer.ValidatorsIndex] = indices.Validators.ToBuffer()
indexTemplates[indexer.AccountsIndex] = indices.Accounts.ToBuffer()
indexTemplates[indexer.AccountsHistoryIndex] = indices.AccountsHistory.ToBuffer()
indexTemplates[indexer.AccountsESDTIndex] = indices.AccountsESDT.ToBuffer()
indexTemplates[indexer.AccountsESDTHistoryIndex] = indices.AccountsESDTHistory.ToBuffer()
indexTemplates[indexer.EpochInfoIndex] = indices.EpochInfo.ToBuffer()
indexTemplates[indexer.ReceiptsIndex] = indices.Receipts.ToBuffer()
indexTemplates[indexer.ScResultsIndex] = indices.SCResults.ToBuffer()
indexTemplates[indexer.SCDeploysIndex] = indices.SCDeploys.ToBuffer()
indexTemplates[indexer.TokensIndex] = indices.Tokens.ToBuffer()
indexTemplates[indexer.TagsIndex] = indices.Tags.ToBuffer()
indexTemplates[indexer.LogsIndex] = indices.Logs.ToBuffer()
indexTemplates[indexer.DelegatorsIndex] = indices.Delegators.ToBuffer()
indexTemplates[indexer.OperationsIndex] = indices.Operations.ToBuffer()
indexTemplates[indexer.ESDTsIndex] = indices.ESDTs.ToBuffer()
indexTemplates[indexer.ValuesIndex] = indices.Values.ToBuffer()
indexTemplates[indexer.EventsIndex] = indices.Events.ToBuffer()

return indexTemplates, indexPolicies, nil
}

// GetExtraMappings will return an array of indices extra mappings
func (tr *templatesAndPolicyReader) GetExtraMappings() ([]templates.ExtraMapping, error) {
return []templates.ExtraMapping{}, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func TestTemplatesAndPolicyReaderNoKibana_GetElasticTemplatesAndPolicies(t *testing.T) {
t.Parallel()

reader := NewTemplatesAndPolicyReaderNoKibana()
reader := NewTemplatesAndPolicyReader()

templates, policies, err := reader.GetElasticTemplatesAndPolicies()
require.Nil(t, err)
Expand Down

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions process/elasticproc/templatesAndPolicies/withKibana.go

This file was deleted.

18 changes: 0 additions & 18 deletions process/elasticproc/templatesAndPolicies/withKibana_test.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

import (
"github.com/multiversx/mx-chain-es-indexer-go/templates"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// AccountsESDT will hold the configuration for the accountsesdt index
var AccountsESDT = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// AccountsESDTHistory will hold the configuration for the accountsesdthistory index
var AccountsESDTHistory = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// AccountsHistory will hold the configuration for the accountshistory index
var AccountsHistory = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// Blocks will hold the configuration for the blocks index
var Blocks = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// Delegators will hold the configuration for the delegators index
var Delegators = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// SCDeploys will hold the configuration for the scdeploys index
var SCDeploys = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// EpochInfo will hold the configuration for the epochinfo index
var EpochInfo = Object{
Expand Down
2 changes: 1 addition & 1 deletion templates/noKibana/esdts.go → templates/indices/esdts.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// ESDTs will hold the configuration for the esdts index
var ESDTs = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// Events will hold the configuration for the events index
var Events = Object{
Expand Down
2 changes: 1 addition & 1 deletion templates/noKibana/logs.go → templates/indices/logs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// Logs will hold the configuration for the logs index
var Logs = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// Miniblocks will hold the configuration for the miniblocks index
var Miniblocks = Object{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package noKibana
package indices

// OpenDistro will hold the configuration for the opendistro
var OpenDistro = Object{
Expand Down
Loading
Loading