Package org.elasticsearch.common.settings

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


        }
      }
    }

    // Set the cluster name and build the settings
    Settings settings = settingsBuilder.put("cluster.name", clusterName).build();
   
    // Prefer TransportClient
    if (host != null && port > 1) {
      client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host, port));
    } else if (clusterName != null) {
View Full Code Here


     */
    @Override
    public void start() {
        super.start();

        Settings settings = ImmutableSettings.settingsBuilder()
                .put("cluster.name", configurator.getClusterName())
                .put("client.transport.sniff", configurator.getClientTransportSniff())
                .build();

        client = clientFactory.create(settings);
View Full Code Here

    return buildNode(id, settings.build());
  }

  public Node buildNode(String id, Settings settings) {
    String settingsSource = getClass().getName().replace('.', '/') + ".yml";
    Settings finalSettings = settingsBuilder()
            .loadFromClasspath(settingsSource)
            .put(defaultSettings)
            .put(settings)
            .put("name", id)
            .put("path.data", ES_DATA_DIR)
            .build();

    if (finalSettings.get("gateway.type") == null) {
      // default to non gateway
      finalSettings = settingsBuilder().put(finalSettings).put("gateway.type", "none").build();
    }
    if (finalSettings.get("cluster.routing.schedule") != null) {
      // decrease the routing schedule so new nodes will be added quickly
      finalSettings = settingsBuilder().put(finalSettings).put("cluster.routing.schedule", "50ms").build();
    }

    Node node = nodeBuilder()
View Full Code Here

    timestampedIndexName = DEFAULT_INDEX_NAME + '-'
        + ElasticSearchIndexRequestBuilderFactory.df.format(FIXED_TIME_MILLIS);
  }

  void createNodes() throws Exception {
    Settings settings = ImmutableSettings
        .settingsBuilder()
        .put("number_of_shards", 1)
        .put("number_of_replicas", 0)
        .put("routing.hash.type", "simple")
        .put("gateway.type", "none")
View Full Code Here

    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

    return buildNode(id, settings.build());
  }

  public Node buildNode(String id, Settings settings) {
    String settingsSource = getClass().getName().replace('.', '/') + ".yml";
    Settings finalSettings = settingsBuilder()
            .loadFromClasspath(settingsSource)
            .put(defaultSettings)
            .put(settings)
            .put("name", id)
            .put("path.data", ES_DATA_DIR)
            .build();

    if (finalSettings.get("gateway.type") == null) {
      // default to non gateway
      finalSettings = settingsBuilder().put(finalSettings).put("gateway.type", "none").build();
    }
    if (finalSettings.get("cluster.routing.schedule") != null) {
      // decrease the routing schedule so new nodes will be added quickly
      finalSettings = settingsBuilder().put(finalSettings).put("cluster.routing.schedule", "50ms").build();
    }

    Node node = nodeBuilder()
View Full Code Here

     * @param clusterName the name of the elasticsearch cluster to connect to
     * @return the native client that will be used within the shell
     */
    @Override
    public ShellNativeClient newNodeClient(String clusterName) {
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("name", shellSettings.settings().get(ShellSettings.NODE_NAME))
                .put("http.enabled", false)
                .build();
        Node node  = NodeBuilder.nodeBuilder().clusterName(clusterName).client(true).settings(settings).build();
        node.start();
View Full Code Here

        return newTransportClient(transportAddresses);
    }

    protected ShellNativeClient newTransportClient(TransportAddress... addresses) {

        Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.ignore_cluster_name", true).build();
        org.elasticsearch.client.transport.TransportClient client = new TransportClient(settings).addTransportAddresses(addresses);

        //if no connected node we can already close the (useless) client
        if (client.connectedNodes().size() == 0) {
            client.close();
View Full Code Here

    public static DocumentMapperParser newMapperParser() {
        return newMapperParser(ImmutableSettings.Builder.EMPTY_SETTINGS);
    }

    public static DocumentMapperParser newMapperParser(Settings settings) {
        Settings forcedSettings = ImmutableSettings.builder()
                .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
                .put(settings)
                .build();
        return new DocumentMapperParser(new Index("test"), forcedSettings, MapperTestUtils.newAnalysisService(forcedSettings), null, null, null, null);
    }
View Full Code Here

        String sniff = properties.getProperty("storage.index.search.sniff", null);
        if (sniff != null) {
            builder.put("client.transport.sniff", sniff);
        }

        Settings settings = builder.build();

        if (properties.getProperty("storage.index.search.local-mode").equals("true")) {
            elasticSearchNode = NodeBuilder.nodeBuilder()
                    .data(false)
                    .local(true)
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.