Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index transactions in elasticsearch database sorted #2025

Merged
merged 2 commits into from
Jun 26, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/indexer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func timestampMapping() io.Reader {
return strings.NewReader(
`{
"settings": {"index": {"sort.field": "timestamp", "sort.order": "desc"}},
"mappings": {"_doc": {"properties": {"timestamp": {"type": "date"}}}}
"mappings": {"properties": {"timestamp": {"type": "date"}}}
}`,
)
}
Expand Down Expand Up @@ -273,7 +273,7 @@ func serializeBulkMiniBlocks(
}
} else {
// update miniblock
meta = []byte(fmt.Sprintf(`{ "update" : { "_id" : "%s", "_type" : "%s" } }%s`, mb.Hash, "_doc", "\n"))
meta = []byte(fmt.Sprintf(`{ "update" : { "_id" : "%s" } }%s`, mb.Hash, "\n"))
if hdrShardID == mb.SenderShardID {
// update sender block hash
serializedData = []byte(fmt.Sprintf(`{ "doc" : { "senderBlockHash" : "%s" } }`, mb.SenderBlockHash))
Expand Down Expand Up @@ -399,7 +399,7 @@ func prepareSerializedDataForATransaction(
meta, serializedData = prepareTxUpdate(tx)
} else {
// insert transaction in database
meta = []byte(fmt.Sprintf(`{ "index" : { "_id" : "%s", "_type" : "%s" } }%s`, tx.Hash, "_doc", "\n"))
meta = []byte(fmt.Sprintf(`{ "index" : { "_id" : "%s" } }%s`, tx.Hash, "\n"))
serializedData, err = json.Marshal(tx)
if err != nil {
log.Debug("indexer: marshal",
Expand Down
1 change: 0 additions & 1 deletion core/indexer/elasticsearchDatabaseClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ func (dc *databaseClient) DoMultiGet(obj object, index string) (object, error) {

res, err = dc.dbClient.Mget(
&body,
dc.dbClient.Mget.WithDocumentType("_doc"),
dc.dbClient.Mget.WithIndex(index),
)
if err != nil {
Expand Down