org.elasticsearch.action.admin.indices.open.OpenIndexResponse Java Examples

The following examples show how to use org.elasticsearch.action.admin.indices.open.OpenIndexResponse. 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: RestOpenIndexAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index")));
    openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout()));
    openIndexRequest.masterNodeTimeout(request.paramAsTime("master_timeout", openIndexRequest.masterNodeTimeout()));
    openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions()));
    client.admin().indices().open(openIndexRequest, new AcknowledgedRestListener<OpenIndexResponse>(channel));
}
 
Example #2
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 5 votes vote down vote up
public OpenIndexResponse openIndex(final String index, final BuilderCallback<OpenIndexRequestBuilder> builder) {
    final OpenIndexResponse actionGet = builder.apply(client().admin().indices().prepareOpen(index)).execute().actionGet();
    if (!actionGet.isAcknowledged()) {
        onFailure("Failed to open " + index + ".", actionGet);
    }
    return actionGet;
}
 
Example #3
Source File: OpenIndexRequestBuilder.java    From elasticshell with Apache License 2.0 5 votes vote down vote up
@Override
protected XContentBuilder toXContent(OpenIndexRequest request, OpenIndexResponse response, XContentBuilder builder) throws IOException {
    return builder.startObject()
            .field(Fields.OK, true)
            .field(Fields.ACKNOWLEDGED, response.isAcknowledged())
            .endObject();
}
 
Example #4
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<OpenIndexResponse> open(final OpenIndexRequest request) {
    return execute(OpenIndexAction.INSTANCE, request);
}
 
Example #5
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void open(final OpenIndexRequest request, final ActionListener<OpenIndexResponse> listener) {
    execute(OpenIndexAction.INSTANCE, request, listener);
}
 
Example #6
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 4 votes vote down vote up
public OpenIndexResponse openIndex(final String index) {
    return openIndex(index, builder -> builder);
}
 
Example #7
Source File: OpenIndexRequestBuilder.java    From elasticshell with Apache License 2.0 4 votes vote down vote up
@Override
protected ActionFuture<OpenIndexResponse> doExecute(OpenIndexRequest request) {
    return client.admin().indices().open(request);
}
 
Example #8
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Open an index based on the index name.
 *
 * @param request The close index request
 * @return The result future
 * @see org.elasticsearch.client.Requests#openIndexRequest(String)
 */
ActionFuture<OpenIndexResponse> open(OpenIndexRequest request);
 
Example #9
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Open an index based on the index name.
 *
 * @param request  The close index request
 * @param listener A listener to be notified with a result
 * @see org.elasticsearch.client.Requests#openIndexRequest(String)
 */
void open(OpenIndexRequest request, ActionListener<OpenIndexResponse> listener);