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

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


        addresses.put("1", address);

        logger.info("websocket address = {}", address);

        logger.info("creating index {}", INDEX);
        client("1").admin().indices().create(new CreateIndexRequest(INDEX)).actionGet();
        logger.info("index {} created", INDEX);
    }
View Full Code Here


    public void createIndex(String indexName) {
        // no need for the following because of _default mapping under config
        // String fileAsString = Helper.readInputStream(getClass().getResourceAsStream("tweet.json"));
        // new CreateIndexRequest(indexName).mapping(indexType, fileAsString)
        client.admin().indices().create(new CreateIndexRequest(indexName)).actionGet();
//        waitForYellow();
    }
View Full Code Here

   
    if (null != settings) { // Need to create the index
     
      for (int i = 0; i < 10; i++) { // retry up to 10 times if NoNodeAvailableException found
        try {
          CreateIndexRequest cir = new CreateIndexRequest(_sIndexName);
          String sCachePolicy = properties.getElasticCachePolicy();
          if (null != sCachePolicy) {
            settings.put("index.cache.field.type", sCachePolicy);
          }
          if (null != sMapping) {
            cir.mapping(_sIndexType, sMapping);
          }
          cir.settings(settings.build());
          _elasticClient.admin().indices().create(cir).actionGet();
         
          //(Wait for above operation to be completed)
          _elasticClient.admin().cluster().health(new ClusterHealthRequest(_sIndexName).waitForYellowStatus()).actionGet();
          break;
View Full Code Here

                getState().getMetaData().getIndices();
        return map.containsKey(indexName);
    }

    public void createIndex(String indexName) {
        client.admin().indices().create(new CreateIndexRequest(indexName)).actionGet();
    }
View Full Code Here

     
      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

    }

    @Before
    public void setUp() throws IOException {
        client().admin().indices().delete(new DeleteIndexRequest("_all")).actionGet();
        client().admin().indices().create(new CreateIndexRequest(__index)).actionGet();
        client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
        final String mapping = XContentFactory.jsonBuilder()
                .startObject()
                .startObject(__type)
                .startObject("_all").field("enabled", false).endObject()
View Full Code Here

    }

    @Before
    public void setUp() throws IOException {
        client().admin().indices().delete(new DeleteIndexRequest("_all")).actionGet();
        client().admin().indices().create(new CreateIndexRequest(__index)).actionGet();
        client().admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
        final String mapping = XContentFactory.jsonBuilder()
                .startObject()
                .startObject(__type1)
                .startObject("_all").field("enabled", false).endObject()
View Full Code Here

    }

    private void createIndexIfRequired(final String indexName) {
        if (!indicesCreated.contains(indexName) || autoCreateIndex.shouldAutoCreate(indexName, clusterService.state())) {
            try {
                transportCreateIndexAction.execute(new CreateIndexRequest(indexName).cause("bulkShardProcessor")).actionGet();
                indicesCreated.add(indexName);
            } catch (ElasticsearchException e) {
                if (e instanceof IndexAlreadyExistsException) {
                    // copy from with multiple readers might attempt to create the index
                    // multiple times
View Full Code Here

        ImmutableSettings.Builder builder = ImmutableSettings.builder();
        builder.put(indexSettings);
        builder.put(SETTING_INDEX_BLOBS_ENABLED, true);

        final SettableFuture<Void> result = SettableFuture.create();
        transportCreateIndexAction.execute(new CreateIndexRequest(fullIndexName(tableName), builder.build()), new ActionListener<CreateIndexResponse>() {
            @Override
            public void onResponse(CreateIndexResponse createIndexResponse) {
                assert createIndexResponse.isAcknowledged();
                result.set(null);
            }
View Full Code Here

        // real work done in createTable()
        deleteOrphans(new CreateTableResponseListener());
    }

    private CreateIndexRequest createIndexRequest() {
        return new CreateIndexRequest(planNode.tableName(), planNode.settings())
                .mapping(Constants.DEFAULT_MAPPING_TYPE, planNode.mapping());
    }
View Full Code Here

TOP

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

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.