From fe368a74565e736ad1fb1dfc20ab364379d83ae9 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Wed, 19 Jul 2017 09:43:05 +0100 Subject: PLT-6595: API to purge Elasticsearch indexes. (#6971) --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model') diff --git a/model/client4.go b/model/client4.go index a19a17d3a..feff9f8de 100644 --- a/model/client4.go +++ b/model/client4.go @@ -2551,6 +2551,16 @@ func (c *Client4) TestElasticsearch() (bool, *Response) { } } +// PurgeElasticsearchIndexes immediately deletes all Elasticsearch indexes. +func (c *Client4) PurgeElasticsearchIndexes() (bool, *Response) { + if r, err := c.DoApiPost(c.GetElasticsearchRoute()+"/test", ""); err != nil { + return false, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // Commands Section // CreateCommand will create a new command if the user have the right permissions. -- cgit v1.2.3-1-g7c22