[DOCS] Javadoc: delete index request does not support empty String

In 0.90.x I was able to delete all my indices from the java api by calling

    client.admin().indices().prepareDelete(new String[] {}).execute().actionGet();

However this fails in 1.0.0 with

org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: index / indices is missing;
	at org.elasticsearch.action.ValidateActions.addValidationError(ValidateActions.java:29)
	at org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest.validate(DeleteIndexRequest.java:72)
	*snip long stacktrace*

which points me to

    public ActionRequestValidationException validate() {
        ActionRequestValidationException validationException = null;
        if (indices == null || indices.length == 0) {
            validationException = addValidationError("index / indices is missing", validationException);
        }
        return validationException;
    }

So that's what now throws the error, however the documentation still says:

    /**
     * Deletes an index based on the index name.
     *
     * @param indices The indices to delete. Empty array to delete all indices.
     */
    DeleteIndexRequestBuilder prepareDelete(String... indices);

Closes #5164.
Closes #5167.
Closes #5168.
This commit is contained in:
constantijn 2014-02-18 19:33:13 +01:00 committed by David Pilato
parent 86a883b4bf
commit 369dba126c
2 changed files with 8 additions and 1 deletions

View File

@ -47,11 +47,18 @@ public class DeleteIndexRequest extends MasterNodeOperationRequest<DeleteIndexRe
/** /**
* Constructs a new delete index request for the specified index. * Constructs a new delete index request for the specified index.
*
* @param index The index to delete. Use "_all" to delete all indices.
*/ */
public DeleteIndexRequest(String index) { public DeleteIndexRequest(String index) {
this.indices = new String[]{index}; this.indices = new String[]{index};
} }
/**
* Constructs a new delete index request for the specified indices.
*
* @param indices The indices to delete. Use "_all" to delete all indices.
*/
public DeleteIndexRequest(String... indices) { public DeleteIndexRequest(String... indices) {
this.indices = indices; this.indices = indices;
} }

View File

@ -276,7 +276,7 @@ public interface IndicesAdminClient {
/** /**
* Deletes an index based on the index name. * Deletes an index based on the index name.
* *
* @param indices The indices to delete. Empty array to delete all indices. * @param indices The indices to delete. Use "_all" to delete all indices.
*/ */
DeleteIndexRequestBuilder prepareDelete(String... indices); DeleteIndexRequestBuilder prepareDelete(String... indices);