org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse Java Examples
The following examples show how to use
org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrudDemo.java From javabase with Apache License 2.0 | 6 votes |
/** * 索引的相关操作 * * @param indicesAdminClient * @param indexName * @throws IOException */ private static void indexConfig(IndicesAdminClient indicesAdminClient, String indexName) throws IOException { //settings 设置 String settings = getIndexSetting(); // PUT /my_temp_index/_settings updatesettings showIndexSettings(indicesAdminClient,indexName); UpdateSettingsResponse updateSettingsResponse = indicesAdminClient.prepareUpdateSettings(indexName).setSettings(settings).execute().actionGet(); log.info("更新 index setting:{}", updateSettingsResponse); //更新索引settings之前要关闭索引 indicesAdminClient.close(new CloseIndexRequest().indices(indexName)).actionGet(); //配置拼音自定义分析器 indicesAdminClient.prepareUpdateSettings(indexName).setSettings(getIndexPinYinSetting()).execute().actionGet(); //自定义分析器 indicesAdminClient.prepareUpdateSettings(indexName).setSettings(getIndexDemoSetting()).execute().actionGet(); //打开索引 indicesAdminClient.open(new OpenIndexRequest().indices(indexName)).actionGet(); //索引别名映射 createAliasIndex(indicesAdminClient); showIndexSettings(indicesAdminClient,indexName); }
Example #2
Source File: BlobIndices.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * can be used to alter the number of replicas. * * @param tableName name of the blob table * @param indexSettings updated index settings */ public ListenableFuture<Void> alterBlobTable(String tableName, Settings indexSettings) { final SettableFuture<Void> result = SettableFuture.create(); ActionListener<UpdateSettingsResponse> listener = ActionListeners.wrap(result, Functions.<Void>constant(null)); transportUpdateSettingsActionProvider.get().execute( new UpdateSettingsRequest(indexSettings, fullIndexName(tableName)), listener); return result; }
Example #3
Source File: AlterTableOperation.java From Elasticsearch with Apache License 2.0 | 5 votes |
private ListenableFuture<Long> updateSettings(TableParameter concreteTableParameter, String... indices) { if (concreteTableParameter.settings().getAsMap().isEmpty() || indices.length == 0) { return Futures.immediateFuture(null); } UpdateSettingsRequest request = new UpdateSettingsRequest(concreteTableParameter.settings(), indices); request.indicesOptions(IndicesOptions.lenientExpandOpen()); SettableFuture<Long> result = SettableFuture.create(); transportActionProvider.transportUpdateSettingsAction().execute(request, new SettableFutureToNullActionListener<UpdateSettingsResponse>(result)); return result; }
Example #4
Source File: ESClient.java From uavstack with Apache License 2.0 | 5 votes |
/** * updateIndexSetting * * @param index * @param set * @return */ public boolean updateIndexSetting(String index, Map<String, Object> set) { try { UpdateSettingsResponse usr = client.admin().indices().prepareUpdateSettings(index).setSettings(set).get(); return usr.isAcknowledged(); } catch (Exception e) { return false; } }
Example #5
Source File: Indexer.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * Adds settings to index * * @param index * - name of the index * @param setting * - settings represented as a JSON String * @throws IOException */ private static void addIndexSetting(String index, String setting) throws IOException { UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(); updateSettingsRequest.indices(index); updateSettingsRequest.settings(setting, XContentType.JSON); UpdateSettingsResponse updateSettingsResponse = highLevelClient.indices().putSettings(updateSettingsRequest, getWriteHeaders()); if (updateSettingsResponse.isAcknowledged() == true) { System.out.println("[INDEXER] \tSettings have been added to " + index); } }
Example #6
Source File: PluginClient.java From openshift-elasticsearch-plugin with Apache License 2.0 | 5 votes |
public UpdateSettingsResponse updateSettings(final String index, Settings settings) { return execute(new Callable<UpdateSettingsResponse>() { @Override public UpdateSettingsResponse call() throws Exception { UpdateSettingsRequestBuilder builder = client.admin().indices().prepareUpdateSettings(index) .setSettings(settings); return builder.get(); } }); }
Example #7
Source File: AbstractClient.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public ActionFuture<UpdateSettingsResponse> updateSettings(final UpdateSettingsRequest request) { return execute(UpdateSettingsAction.INSTANCE, request); }
Example #8
Source File: AbstractClient.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public void updateSettings(final UpdateSettingsRequest request, final ActionListener<UpdateSettingsResponse> listener) { execute(UpdateSettingsAction.INSTANCE, request, listener); }
Example #9
Source File: IndicesAdminClient.java From Elasticsearch with Apache License 2.0 | 2 votes |
/** * Updates settings of one or more indices. * * @param request the update settings request * @return The result future */ ActionFuture<UpdateSettingsResponse> updateSettings(UpdateSettingsRequest request);
Example #10
Source File: IndicesAdminClient.java From Elasticsearch with Apache License 2.0 | 2 votes |
/** * Updates settings of one or more indices. * * @param request the update settings request * @param listener A listener to be notified with the response */ void updateSettings(UpdateSettingsRequest request, ActionListener<UpdateSettingsResponse> listener);