Package org.elasticsearch.action.admin.indices.create

Examples of org.elasticsearch.action.admin.indices.create.CreateIndexResponse


        startNode("server1", settings);

        ClusterService clusterService1 = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class);

        logger.info("Creating index [test]");
        CreateIndexResponse createIndexResponse = client("server1").admin().indices().create(createIndexRequest("test")).actionGet();
        assertThat(createIndexResponse.acknowledged(), equalTo(true));

        logger.info("Running Cluster Health");
        ClusterHealthResponse clusterHealth = client("server1").admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
View Full Code Here


        startNode("server1", settings);

        ClusterService clusterService1 = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class);

        logger.info("Creating index [test]");
        CreateIndexResponse createIndexResponse = client("server1").admin().indices().create(createIndexRequest("test")).actionGet();
        assertThat(createIndexResponse.acknowledged(), equalTo(true));

        logger.info("Running Cluster Health");
        ClusterHealthResponse clusterHealth = client("server1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
View Full Code Here

        node.close();
    }

    @Test public void testHdfsGateway() throws Exception {
        // first, test meta data
        CreateIndexResponse createIndexResponse = node.client().admin().indices().create(createIndexRequest("test")).actionGet();
        assertThat(createIndexResponse.acknowledged(), equalTo(true));
        node.close();
        node = buildNode().start();

        logger.info("--> waiting for green status");
        ClusterHealthResponse health = node.client().admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
View Full Code Here

        final String robotIndexName = SingletonS2Container
                .getComponent("robotIndexName");
        final IndicesExistsResponse indicesExistsResponse = client.admin()
                .indices().prepareExists(robotIndexName).execute().actionGet();
        if (!indicesExistsResponse.isExists()) {
            final CreateIndexResponse createIndexResponse = client.admin()
                    .indices().prepareCreate(robotIndexName).execute()
                    .actionGet();
            if (createIndexResponse.isAcknowledged()) {
                try {
                    createMapping(robotIndexName, "queue", createQueueMapping());
                    createMapping(robotIndexName, "filter",
                            createFilterMapping());
                    createMapping(robotIndexName, "data", createDataMapping());
View Full Code Here

    try {
     
      XContentBuilder settings = MappingUtil.getSettingsMapper(mapper);
     
      Logger.debug("Starting Elastic Search Index %s", indexName);
      CreateIndexResponse response = client.admin().indices()
          .create(new CreateIndexRequest(indexName)
          .settings(ImmutableSettings.settingsBuilder().loadFromSource(settings.string())))
          .actionGet();

      Logger.debug("Response: %s", response);
View Full Code Here

    }


    private void createIndexWithProductsMapping(String indexName) throws IOException {
        String settingsData = IOUtils.toString(this.getClass().getResourceAsStream("/product.json"));
        CreateIndexResponse createIndexResponse = client().admin().indices().prepareCreate(indexName)
                .setSource(settingsData).execute().actionGet();
        assertThat(createIndexResponse.isAcknowledged(), is(true));

        client().admin().cluster().prepareHealth(indexName).setWaitForGreenStatus().execute().actionGet();
    }
View Full Code Here

      Settings settings = getStoreSettings(index);
      if (settings != null) {
        request.setSettings(settings);
      }

      CreateIndexResponse response = request
          .setTimeout(TimeValue.timeValueSeconds(INDEX_CREATION_TIMEOUT_SECONDS)).execute().actionGet();

      if (!response.isAcknowledged()) {
        log.warn("index creation not acknowledged within " + INDEX_CREATION_TIMEOUT_SECONDS + " seconds");
      }

      // TODO newly created. auto rebuild?
View Full Code Here

    }

    private void createIndex(String name) {
        log.info("Trying to create index {}", name);
        try {
            CreateIndexResponse response = node.client().admin().indices().prepareCreate(name).setSettings(ImmutableSettings.settingsBuilder().put("numberOfShards", "1")).execute().actionGet();
            log.info("Indexresponse for creating of index {}: {}", name, response.acknowledged());
        } catch (IndexAlreadyExistsException e) {}
    }
View Full Code Here

                .setWaitForYellowStatus().execute().actionGet();

        //Create index if it does not already exist
        IndicesExistsResponse response = client.admin().indices().exists(new IndicesExistsRequest(indexName)).actionGet();
        if (!response.isExists()) {
            CreateIndexResponse create = client.admin().indices().prepareCreate(indexName).execute().actionGet();
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                throw new TitanException("Interrupted while waiting for index to settle in", e);
            }
            if (!create.isAcknowledged()) throw new IllegalArgumentException("Could not create index: " + indexName);
        }
    }
View Full Code Here

    if (source != null) {
      if (logger.isTraceEnabled()) logger.trace("Found settings for index "+index+" : " + source);
      cirb.setSettings(source);
    }
   
    CreateIndexResponse createIndexResponse = cirb.execute().actionGet();
    if (!createIndexResponse.isAcknowledged()) throw new Exception("Could not create index ["+index+"].");
    if (logger.isTraceEnabled()) logger.trace("/createIndex("+index+")");
  }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.create.CreateIndexResponse

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.