fix doc add id creation, use rand.Int64()

This commit is contained in:
2026-05-29 14:42:36 +02:00
parent 2b2094b155
commit f1877c6903

View File

@@ -21,8 +21,8 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/rand/v2"
"strings" "strings"
"time"
"codeberg.org/scip/esctl/pkg/cfg" "codeberg.org/scip/esctl/pkg/cfg"
"github.com/elastic/go-elasticsearch/v9/typedapi/core/deletebyquery" "github.com/elastic/go-elasticsearch/v9/typedapi/core/deletebyquery"
@@ -45,7 +45,7 @@ func DocAdd(conf *cfg.Config, jsondoc string) error {
return fmt.Errorf("supplied document was not valid JSON: %s", err) return fmt.Errorf("supplied document was not valid JSON: %s", err)
} }
now := fmt.Sprintf("%d", time.Now().Unix()) now := fmt.Sprintf("%d", rand.Int64())
res, err := conf.DefaultCluster.ES.Create(conf.Index, now). res, err := conf.DefaultCluster.ES.Create(conf.Index, now).
Document(data). Document(data).