Browse Source

_optimize was renamed to _forcemerge in ES 2.1.0

tags/v1.2.2
Paul Bonser 7 years ago
parent
commit
a6663ce61d
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      goes.go

+ 8
- 0
goes.go View File

@@ -119,10 +119,18 @@ func (c *Client) Optimize(indexList []string, extraArgs url.Values) (*Response,
Method: "POST",
API: "_optimize",
}
if version, _ := c.Version(); version > "2.1" {
r.API = "_forcemerge"
}

return c.Do(&r)
}

// ForceMerge is the same as Optimize, but matches the naming of the endpoint as of ES 2.1.0
func (c *Client) ForceMerge(indexList []string, extraArgs url.Values) (*Response, error) {
return c.Optimize(indexList, extraArgs)
}

// Stats fetches statistics (_stats) for the current elasticsearch server
func (c *Client) Stats(indexList []string, extraArgs url.Values) (*Response, error) {
r := Request{


Loading…
Cancel
Save