mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 13:54:17 +02:00
fix doc add id creation, use rand.Int64()
This commit is contained in:
@@ -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).
|
||||||
|
|||||||
Reference in New Issue
Block a user