Examples of CreateIndexResponse


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

    }

    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

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

                .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

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

    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

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

        ensureGreen();
    }

    @Test
    public void testCreateIndexNoAcknowledgement() {
        CreateIndexResponse createIndexResponse = client().admin().indices().prepareCreate("test").setTimeout("0s").get();
        assertThat(createIndexResponse.isAcknowledged(), equalTo(false));

        //let's wait for green, otherwise there can be issues with after test checks (mock directory wrapper etc.)
        ensureGreen();
    }
View Full Code Here

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

public class GetIndexBackwardsCompatibilityTests extends ElasticsearchBackwardsCompatIntegrationTest {

    @Test
    public void testGetAliases() throws Exception {
        CreateIndexResponse createIndexResponse = prepareCreate("test").addAlias(new Alias("testAlias")).execute().actionGet();
        assertAcked(createIndexResponse);
        GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().addIndices("test").addFeatures("_aliases")
                .execute().actionGet();
        ImmutableOpenMap<String, ImmutableList<AliasMetaData>> aliasesMap = getIndexResponse.aliases();
        assertThat(aliasesMap, notNullValue());
View Full Code Here

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

        assertThat(alias.alias(), equalTo("testAlias"));
    }

    @Test
    public void testGetMappings() throws Exception {
        CreateIndexResponse createIndexResponse = prepareCreate("test").addMapping("type1", "{\"type1\":{}}").execute().actionGet();
        assertAcked(createIndexResponse);
        GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().addIndices("test").addFeatures("_mappings")
                .execute().actionGet();
        ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = getIndexResponse.mappings();
        assertThat(mappings, notNullValue());
View Full Code Here

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

        assertThat(mapping.type(), equalTo("type1"));
    }

    @Test
    public void testGetSettings() throws Exception {
        CreateIndexResponse createIndexResponse = prepareCreate("test").setSettings(ImmutableSettings.builder().put("number_of_shards", 1)).execute().actionGet();
        assertAcked(createIndexResponse);
        GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().addIndices("test").addFeatures("_settings")
                .execute().actionGet();
        ImmutableOpenMap<String, Settings> settingsMap = getIndexResponse.settings();
        assertThat(settingsMap, notNullValue());
View Full Code Here

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

        canIndexDocument("test1");
    }

    private void canCreateIndex(String index) {
        try {
            CreateIndexResponse r = client().admin().indices().prepareCreate(index).execute().actionGet();
            assertThat(r, notNullValue());
        } catch (ClusterBlockException e) {
            fail();
        }
    }
View Full Code Here

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

    // Make sure the site index exists
    try {
      IndicesAdminClient indexAdmin = nodeClient.admin().indices();
      CreateIndexRequestBuilder siteIdxRequest = indexAdmin.prepareCreate(site.getIdentifier());
      logger.debug("Trying to create site index for '{}'", site.getIdentifier());
      CreateIndexResponse siteidxResponse = siteIdxRequest.execute().actionGet();
      if (!siteidxResponse.acknowledged()) {
        throw new ContentRepositoryException("Unable to create site index for '" + site.getIdentifier() + "'");
      }
    } catch (IndexAlreadyExistsException e) {
      logger.info("Detected existing index '{}'", site.getIdentifier());
    }
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.