Skip to content

Commit

Permalink
Merge pull request #7 from zvictorino/master
Browse files Browse the repository at this point in the history
esm exhausted all local ports
  • Loading branch information
medcl authored Jun 4, 2018
2 parents 8490a28 + 03bd37e commit 64e92d1
Show file tree
Hide file tree
Showing 6 changed files with 401 additions and 367 deletions.
1 change: 1 addition & 0 deletions domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type Config struct {
SourceProxy string `long:"source_proxy" description:"set proxy to source http connections, ie: http://127.0.0.1:8080"`
TargetProxy string `long:"dest_proxy" description:"set proxy to target http connections, ie: http://127.0.0.1:8080"`
Refresh bool `long:"refresh" description:"refresh after migration finished"`
Fields string `long:"fields" description:"output fields, comma separated, ie: col1,col2,col3,..." `

}

Expand Down
2 changes: 1 addition & 1 deletion esapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type ESAPI interface{
GetIndexMappings(copyAllIndexes bool,indexNames string)(string,int,*Indexes,error)
UpdateIndexSettings(indexName string,settings map[string]interface{})(error)
UpdateIndexMapping(indexName string,mappings map[string]interface{})(error)
NewScroll(indexNames string,scrollTime string,docBufferCount int,query string, slicedId,maxSlicedCount int)(*Scroll, error)
NewScroll(indexNames string,scrollTime string,docBufferCount int,query string, slicedId,maxSlicedCount int, fields string)(*Scroll, error)
NextScroll(scrollTime string,scrollId string)(*Scroll,error)
Refresh(name string) (err error)
}
6 changes: 4 additions & 2 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/parnurzeal/gorequest"
log "github.com/cihub/seelog"
"io/ioutil"
"io"
"errors"
"bytes"
"net/url"
Expand All @@ -33,7 +34,7 @@ func Get(url string,auth *Auth,proxy string) (*http.Response, string, []error) {
}

request.Header["Content-Type"]= "application/json"

if(len(proxy)>0){
request.Proxy(proxy)
}
Expand All @@ -50,7 +51,7 @@ func Post(url string,auth *Auth, body string,proxy string)(*http.Response, strin
}

request.Header["Content-Type"]= "application/json"

if(len(proxy)>0){
request.Proxy(proxy)
}
Expand Down Expand Up @@ -138,6 +139,7 @@ func Request(method string,r string,auth *Auth,body *bytes.Buffer,proxy string)(
if err != nil {
return string(respBody),err
}
io.Copy(ioutil.Discard, resp.Body)
defer resp.Body.Close()
return string(respBody),nil
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func main() {
totalSize:=0;
finishedSlice:=0
for slice:=0;slice<c.ScrollSliceSize ;slice++ {
scroll, err := migrator.SourceESAPI.NewScroll(c.SourceIndexNames, c.ScrollTime, c.DocBufferCount, c.Query,slice,c.ScrollSliceSize)
scroll, err := migrator.SourceESAPI.NewScroll(c.SourceIndexNames, c.ScrollTime, c.DocBufferCount, c.Query,slice,c.ScrollSliceSize, c.Fields)
if err != nil {
log.Error(err)
return
Expand Down
Loading

0 comments on commit 64e92d1

Please sign in to comment.