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