Package org.elasticsearch.common.settings

Examples of org.elasticsearch.common.settings.Settings$Builder


    node = NodeBuilder.nodeBuilder().client(true).local(true).node();
    client = node.client();
  }

  private void openClient() {
    Settings settings = ImmutableSettings.settingsBuilder()
        .put("cluster.name", clusterName).build();

    TransportClient transport = new TransportClient(settings);
    for (InetSocketTransportAddress host : serverAddresses) {
      transport.addTransportAddress(host);
View Full Code Here


   * @param clusterName
   */
  private void openClient(String clusterName) {
    logger.info("Using ElasticSearch hostnames: {} ",
        Arrays.toString(serverAddresses));
    Settings settings = ImmutableSettings.settingsBuilder()
        .put("cluster.name", clusterName).build();

    TransportClient transportClient = new TransportClient(settings);
    for (InetSocketTransportAddress host : serverAddresses) {
      transportClient.addTransportAddress(host);
View Full Code Here

public class SimpleHunspellAnalysisTests {

    @Test
    public void testSimpleConfigurationYaml() {
        Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/hunspell-1.yml").build();
        AnalysisService analysisService = testSimpleConfiguration(settings);
        TokenFilterFactory filterFactory = analysisService.tokenFilter("hunspell");
        MatcherAssert.assertThat(filterFactory, instanceOf(HunspellStemFilterFactory.class));
    }
View Full Code Here

        MatcherAssert.assertThat(filterFactory, instanceOf(HunspellStemFilterFactory.class));
    }

    @Test
    public void testTicket1() {
        Settings settings = settingsBuilder().loadFromClasspath("org/elasticsearch/index/analysis/hunspell-2.yml").build();
        AnalysisService analysisService = testSimpleConfiguration(settings);
        NamedAnalyzer analyzer = analysisService.analyzer("test");       
    }
View Full Code Here

        } else {
            LOG.info("Joining ElasticSearch cluster " + config.getClusterName());
        }
        node = config.buildNode();
        if (config.getIp() != null && !config.isLocal()) {
            Settings settings = ImmutableSettings.settingsBuilder()
                    .put("cluster.name", config.getClusterName()).put("node.client", true).build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(config.getIp(), config.getPort()));
            this.client = client;
        } else {
View Full Code Here

  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")),
    bucket.get("access_key", settings.get("cloud.aws.access_key")),
    bucket.get("secret_key", settings.get("cloud.aws.secret_key")));

    String bucketName = bucket.get("bucket");
  logger.info("--> verify encryption for bucket [{}], prefix [{}]", bucketName, basePath);
  List<S3ObjectSummary> summaries = s3Client.listObjects(bucketName, basePath).getObjectSummaries();
  for (S3ObjectSummary summary : summaries) {
      assertThat(s3Client.getObjectMetadata(bucketName, summary.getKey()).getSSEAlgorithm(), equalTo("AES256"));
  }
View Full Code Here

     * does not make the test {@link #testRepositoryWithCustomCredentials()} pointless.
     */
    @Test(expected = RepositoryVerificationException.class)
    public void assertRepositoryWithCustomCredentialsIsNotAccessibleByDefaultCredentials() {
        Client client = client();
        Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.private-bucket.");
        logger.info("-->  creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath);
        client.admin().cluster().preparePutRepository("test-repo")
                .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
                        .put("base_path", basePath)
                        .put("bucket", bucketSettings.get("bucket"))
                ).get();
        fail("repository verification should have raise an exception!");
    }
View Full Code Here

    }

    @Test
    public void testRepositoryWithCustomCredentials() {
        Client client = client();
        Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.private-bucket.");
        logger.info("-->  creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath);
        PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
                .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
                        .put("base_path", basePath)
                        .put("region", bucketSettings.get("region"))
                        .put("access_key", bucketSettings.get("access_key"))
                        .put("secret_key", bucketSettings.get("secret_key"))
                        .put("bucket", bucketSettings.get("bucket"))
                ).get();
        assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));

        assertRepositoryIsOperational(client, "test-repo");
    }
View Full Code Here

     * does not make the test {@link #testRepositoryInRemoteRegion()} pointless.
     */
    @Test(expected = RepositoryVerificationException.class)
    public void assertRepositoryInRemoteRegionIsRemote() {
        Client client = client();
        Settings bucketSettings = internalCluster().getInstance(Settings.class).getByPrefix("repositories.s3.remote-bucket.");
        logger.info("-->  creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath);
        client.admin().cluster().preparePutRepository("test-repo")
                .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
                        .put("base_path", basePath)
                        .put("bucket", bucketSettings.get("bucket"))
// Below setting intentionally omitted to assert bucket is not available in default region.
//                        .put("region", privateBucketSettings.get("region"))
                ).get();

        fail("repository verification should have raise an exception!");
View Full Code Here

    }

    @Test
    public void testRepositoryInRemoteRegion() {
        Client client = client();
        Settings settings = internalCluster().getInstance(Settings.class);
        Settings bucketSettings = settings.getByPrefix("repositories.s3.remote-bucket.");
        logger.info("-->  creating s3 repository with bucket[{}] and path [{}]", bucketSettings.get("bucket"), basePath);
        PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
                .setType("s3").setSettings(ImmutableSettings.settingsBuilder()
                        .put("base_path", basePath)
                        .put("bucket", bucketSettings.get("bucket"))
                        .put("region", bucketSettings.get("region"))
                ).get();
        assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));

        assertRepositoryIsOperational(client, "test-repo");
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.settings.Settings$Builder

Copyright © 2018 www.massapicom. 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.