Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Snapshot Create API #531

Closed
wants to merge 1 commit into from
Closed

Add Snapshot Create API #531

wants to merge 1 commit into from

Conversation

wedneyyuri
Copy link
Contributor

@wedneyyuri wedneyyuri commented May 17, 2017

This PR adds support for Elasticsearch's snapshot API.

Example program:

package main

import (
	"context"
	"time"

	elastic "gopkg.in/olivere/elastic.v5"
)

func main() {
	client, err := elastic.NewClient()
	if err != nil {
		panic(err)
	}

	response, err := elastic.
		NewSnapshotCreateService(client).
		IncludeGlobalState(true).
		Indices("index1").
		Name(time.Now().Format("2006-01-02-15-04-05")).
		Repository("repo1").
		WaitForCompletion(true).
		Do(context.TODO())
	if err != nil {
		panic("error during elasticsearch snapshot create")
	}

	if response.Snapshot.State != "SUCCESS" {
		panic("elasticsearch snapshot state != SUCCESS: " + response.Snapshot.State)
	}
}

Based on #508

@wedneyyuri wedneyyuri changed the title Add snapshot create Add Snapshot Create API May 17, 2017
@wedneyyuri
Copy link
Contributor Author

I didn't notice the generate-api branch, I will make some changes and reopen when done.

@wedneyyuri wedneyyuri closed this May 19, 2017
@wedneyyuri
Copy link
Contributor Author

Reopened by #533 (another branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant