Search in sources :

Example 1 with UpdateSettingsResponse

use of org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse in project crate by crate.

the class BlobAdminClient method alterBlobTable.

/**
     * can be used to alter the number of replicas.
     *
     * @param tableName     name of the blob table
     * @param indexSettings updated index settings
     */
public CompletableFuture<Void> alterBlobTable(String tableName, Settings indexSettings) {
    FutureActionListener<UpdateSettingsResponse, Void> listener = new FutureActionListener<>(Functions.<Void>constant(null));
    updateSettingsAction.execute(new UpdateSettingsRequest(indexSettings, fullIndexName(tableName)), listener);
    return listener;
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) UpdateSettingsRequest(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest) FutureActionListener(io.crate.action.FutureActionListener)

Example 2 with UpdateSettingsResponse

use of org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse in project crate by crate.

the class AlterTableOperation method updateSettings.

private CompletableFuture<Long> updateSettings(TableParameter concreteTableParameter, String... indices) {
    if (concreteTableParameter.settings().getAsMap().isEmpty() || indices.length == 0) {
        return CompletableFuture.completedFuture(null);
    }
    UpdateSettingsRequest request = new UpdateSettingsRequest(concreteTableParameter.settings(), indices);
    request.indicesOptions(IndicesOptions.lenientExpandOpen());
    FutureActionListener<UpdateSettingsResponse, Long> listener = new FutureActionListener<>(LONG_NULL_FUNCTION);
    transportActionProvider.transportUpdateSettingsAction().execute(request, listener);
    return listener;
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) UpdateSettingsRequest(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest) FutureActionListener(io.crate.action.FutureActionListener)

Example 3 with UpdateSettingsResponse

use of org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse in project elasticsearch by elastic.

the class AckIT method testUpdateSettingsNoAcknowledgement.

public void testUpdateSettingsNoAcknowledgement() {
    createIndex("test");
    UpdateSettingsResponse updateSettingsResponse = client().admin().indices().prepareUpdateSettings("test").setTimeout("0s").setSettings(Settings.builder().put("refresh_interval", 9999, TimeUnit.MILLISECONDS)).get();
    assertThat(updateSettingsResponse.isAcknowledged(), equalTo(false));
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse)

Example 4 with UpdateSettingsResponse

use of org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse in project elasticsearch by elastic.

the class SimpleBlocksIT method setIndexReadOnly.

private void setIndexReadOnly(String index, Object value) {
    HashMap<String, Object> newSettings = new HashMap<>();
    newSettings.put(IndexMetaData.SETTING_READ_ONLY, value);
    UpdateSettingsRequestBuilder settingsRequest = client().admin().indices().prepareUpdateSettings(index);
    settingsRequest.setSettings(newSettings);
    UpdateSettingsResponse settingsResponse = settingsRequest.execute().actionGet();
    assertThat(settingsResponse, notNullValue());
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) HashMap(java.util.HashMap) UpdateSettingsRequestBuilder(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder)

Example 5 with UpdateSettingsResponse

use of org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse in project elasticsearch-suggest-plugin by spinscale.

the class AbstractSuggestTest method gettingStatisticsShouldWork.

@Test
public void gettingStatisticsShouldWork() throws Exception {
    // needed to make sure that we hit the already queried shards for stats, the other are empty
    Settings settings = settingsBuilder().put("index.number_of_replicas", 0).build();
    UpdateSettingsResponse response = client().admin().indices().prepareUpdateSettings(index).setSettings(settings).get();
    assertThat(response.isAcknowledged(), is(true));
    List<Map<String, Object>> products = createProducts("ProductName", "BMW 318", "BMW 528", "BMW M3", "the BMW 320", "VW Jetta");
    indexProducts(products);
    FstStats emptyFstStats = getStatistics();
    assertThat(emptyFstStats.getStats(), hasSize(0));
    assertThat(getFstSizeSum(emptyFstStats), equalTo(0L));
    SuggestionQuery query = new SuggestionQuery(index, type, "ProductName.keyword", "b").suggestType("full").analyzer("stop").size(10);
    List<String> suggestions = getSuggestions(query);
    assertSuggestions(suggestions, "BMW 318", "BMW 528", "BMW M3", "the BMW 320");
    FstStats filledFstStats = getStatistics();
    assertThat(filledFstStats.getStats(), hasSize(greaterThanOrEqualTo(1)));
    List<FstStats.FstIndexShardStats> allStats = Lists.newArrayList(filledFstStats.getStats());
    assertThat(allStats.get(0).getShardId().id(), greaterThanOrEqualTo(0));
    assertThat(getFstSizeSum(filledFstStats), greaterThan(0L));
}
Also used : FstStats(de.spinscale.elasticsearch.action.suggest.statistics.FstStats) UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) Map(java.util.Map) Settings(org.elasticsearch.common.settings.Settings) Test(org.junit.Test) ElasticsearchIntegrationTest(org.elasticsearch.test.ElasticsearchIntegrationTest)

Aggregations

UpdateSettingsResponse (org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse)5 FutureActionListener (io.crate.action.FutureActionListener)2 UpdateSettingsRequest (org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest)2 FstStats (de.spinscale.elasticsearch.action.suggest.statistics.FstStats)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 UpdateSettingsRequestBuilder (org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder)1 Settings (org.elasticsearch.common.settings.Settings)1 ElasticsearchIntegrationTest (org.elasticsearch.test.ElasticsearchIntegrationTest)1 Test (org.junit.Test)1