use of org.opensearch.OpenSearchException in project fess by codelibs.
the class SearchHelper method update.
public boolean update(final String id, final Consumer<UpdateRequestBuilder> builderLambda) {
try {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final UpdateRequestBuilder builder = ComponentUtil.getSearchEngineClient().prepareUpdate().setIndex(fessConfig.getIndexDocumentUpdateIndex()).setId(id);
builderLambda.accept(builder);
final UpdateResponse response = builder.execute().actionGet(fessConfig.getIndexIndexTimeout());
return response.getResult() == Result.CREATED || response.getResult() == Result.UPDATED;
} catch (final OpenSearchException e) {
throw new SearchEngineClientException("Failed to update doc " + id, e);
}
}
Aggregations