From f1877c690327e496213efe17f7b1b98541de9dd9 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Fri, 29 May 2026 14:42:36 +0200 Subject: [PATCH] fix doc add id creation, use rand.Int64() --- pkg/es/doc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/es/doc.go b/pkg/es/doc.go index 18a85c2..58d203e 100644 --- a/pkg/es/doc.go +++ b/pkg/es/doc.go @@ -21,8 +21,8 @@ import ( "encoding/json" "errors" "fmt" + "math/rand/v2" "strings" - "time" "codeberg.org/scip/esctl/pkg/cfg" "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) } - now := fmt.Sprintf("%d", time.Now().Unix()) + now := fmt.Sprintf("%d", rand.Int64()) res, err := conf.DefaultCluster.ES.Create(conf.Index, now). Document(data).