Skip to content

Commit

Permalink
enable to skip cluster status check, use index instead of create for …
Browse files Browse the repository at this point in the history
…bulk operations
  • Loading branch information
medcl committed Sep 5, 2019
1 parent 7dc95a9 commit c4580cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (c *Migrator) NewBulkWorker(docCount *int, pb *pb.ProgressBar, wg *sync.Wai

// encode the doc and and the _source field for a bulk request
post := map[string]Document{
"create": doc,
"index": doc,
}
if err = docEnc.Encode(post); err != nil {
log.Error(err)
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"bufio"
log "github.com/cihub/seelog"
goflags "github.com/jessevdk/go-flags"
pb "gopkg.in/cheggaaa/pb.v1"
"gopkg.in/cheggaaa/pb.v1"
"os"
"io"
"io/ioutil"
Expand Down Expand Up @@ -485,8 +485,12 @@ func (c *Migrator) ClusterVersion(host string, auth *Auth,proxy string) (*Cluste
}

func (c *Migrator) ClusterReady(api ESAPI) (*ClusterHealth, bool) {

health := api.ClusterHealth()

if !c.Config.WaitForGreen{
return health,true
}

if health.Status == "red" {
return health, false
}
Expand Down

0 comments on commit c4580cb

Please sign in to comment.