Maven Java API for snapshot


(Hemant Kumar) #1

Hi,
I am writing java API code to take the snapshot of es. I am unable to find the maven repo for that.
public CreateSnapshotResponse createSnapshot(Client client, String repositoryName,
String snapshotName, String indexName){

    CreateSnapshotResponse createSnapshotResponse = null;
    try {

        if(isSnapshotExist(client, repositoryName, snapshotName))
            logger.info(snapshotName + " snapshot already exists");

        else {

            createSnapshotResponse = client.admin().cluster()
                                     .prepareCreateSnapshot(repositoryName, snapshotName)
                                     .setWaitForCompletion(true)
                                     .setIndices(indexName).get();

            logger.info("Snapshot was created.");
        }

    } catch (Exception ex){
        logger.error("Exception in createSnapshot method: " + ex.toString());

    } finally {
        return createSnapshotResponse;
    }
}

(Hemant Kumar) #2

Help will be appreciated.


(David Pilato) #3

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.


(system) closed #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.