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;
}
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;
}
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));
}
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());
}
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));
}
Aggregations