Examples of admin()


Examples of org.elasticsearch.client.Client.admin()

        assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(50L));
        assertThat(client.prepareCount("test-idx-2").get().getCount(), equalTo(50L));
        assertThat(client.prepareCount("test-idx-3").get().getCount(), equalTo(50L));

        logger.info("--> close indices");
        client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get();

        logger.info("--> restore all indices from the snapshot");
        RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet();
        assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

        logger.info("--> close indices");
        client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get();

        logger.info("--> restore all indices from the snapshot");
        RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet();
        assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));

        ensureGreen();
        assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
        assertThat(client.prepareCount("test-idx-2").get().getCount(), equalTo(100L));
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

        // Test restore after index deletion
        logger.info("--> delete indices");
        cluster().wipeIndices("test-idx-1", "test-idx-2");
        logger.info("--> restore one index after deletion");
        restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet();
        assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
        ensureGreen();
        assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
        ClusterState clusterState = client.admin().cluster().prepareState().get().getState();
        assertThat(clusterState.getMetaData().hasIndex("test-idx-1"), equalTo(true));
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

        logger.info("--> restore one index after deletion");
        restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet();
        assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
        ensureGreen();
        assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
        ClusterState clusterState = client.admin().cluster().prepareState().get().getState();
        assertThat(clusterState.getMetaData().hasIndex("test-idx-1"), equalTo(true));
        assertThat(clusterState.getMetaData().hasIndex("test-idx-2"), equalTo(false));
    }
   
    @Test
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

   
    @Test
    public void testEncryption() {
  Client client = client();
  logger.info("-->  creating s3 repository with bucket[{}] and path [{}]", internalCluster().getInstance(Settings.class).get("repositories.s3.bucket"), basePath);
  PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
    .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
      .put("base_path", basePath)
      .put("chunk_size", randomIntBetween(1000, 10000))
      .put("server_side_encryption", true)
    ).get();
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

  assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
  assertThat(client.prepareCount("test-idx-2").get().getCount(), equalTo(100L));
  assertThat(client.prepareCount("test-idx-3").get().getCount(), equalTo(100L));

  logger.info("--> snapshot");
  CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-3").get();
  assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
  assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));

  assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS));

View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

  logger.info("--> snapshot");
  CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-3").get();
  assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
  assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));

  assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS));

  Settings settings = internalCluster().getInstance(Settings.class);
  Settings bucket = settings.getByPrefix("repositories.s3.");
  AmazonS3 s3Client = internalCluster().getInstance(AwsS3Service.class).client(
    bucket.get("region", settings.get("repositories.s3.region")),
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

  assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(50L));
  assertThat(client.prepareCount("test-idx-2").get().getCount(), equalTo(50L));
  assertThat(client.prepareCount("test-idx-3").get().getCount(), equalTo(50L));

  logger.info("--> close indices");
  client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get();

  logger.info("--> restore all indices from the snapshot");
  RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet();
  assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

  logger.info("--> close indices");
  client.admin().indices().prepareClose("test-idx-1", "test-idx-2").get();

  logger.info("--> restore all indices from the snapshot");
  RestoreSnapshotResponse restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet();
  assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));

  ensureGreen();
  assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
  assertThat(client.prepareCount("test-idx-2").get().getCount(), equalTo(100L));
View Full Code Here

Examples of org.elasticsearch.client.Client.admin()

  // Test restore after index deletion
  logger.info("--> delete indices");
  cluster().wipeIndices("test-idx-1", "test-idx-2");
  logger.info("--> restore one index after deletion");
  restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet();
  assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0));
  ensureGreen();
  assertThat(client.prepareCount("test-idx-1").get().getCount(), equalTo(100L));
  ClusterState clusterState = client.admin().cluster().prepareState().get().getState();
  assertThat(clusterState.getMetaData().hasIndex("test-idx-1"), equalTo(true));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.