Delete mapping is no longer supported in 2.x+ versions of ES
This commit is contained in:
parent
28784db09c
commit
7ee055cb7d
5
goes.go
5
goes.go
@ -504,6 +504,11 @@ func (c *Client) Update(d Document, query interface{}, extraArgs url.Values) (*R
|
|||||||
|
|
||||||
// DeleteMapping deletes a mapping along with all data in the type
|
// DeleteMapping deletes a mapping along with all data in the type
|
||||||
func (c *Client) DeleteMapping(typeName string, indexes []string) (*Response, error) {
|
func (c *Client) DeleteMapping(typeName string, indexes []string) (*Response, error) {
|
||||||
|
if version, err := c.Version(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if version > "2" {
|
||||||
|
return nil, errors.New("Deletion of mappings is not supported in ES 2.x and above.")
|
||||||
|
}
|
||||||
|
|
||||||
r := Request{
|
r := Request{
|
||||||
IndexList: indexes,
|
IndexList: indexes,
|
||||||
|
@ -1365,6 +1365,10 @@ func (s *GoesTestSuite) TestDeleteMapping(c *C) {
|
|||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
|
||||||
response, err = conn.DeleteMapping("tweet", []string{indexName})
|
response, err = conn.DeleteMapping("tweet", []string{indexName})
|
||||||
|
if version, _ := conn.Version(); version > "2" {
|
||||||
|
c.Assert(err, ErrorMatches, ".*not supported.*")
|
||||||
|
return
|
||||||
|
}
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
c.Assert(response.Acknowledged, Equals, true)
|
c.Assert(response.Acknowledged, Equals, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user