Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Büscher committed Jan 4, 2019
1 parent 7b46b5f commit 4a07eed
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
import org.elasticsearch.rest.action.RestToXContentListener;

import java.io.IOException;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
Expand All @@ -47,6 +50,9 @@ public class RestGetIndicesAction extends BaseRestHandler {
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using `include_type_name` in get indices requests is deprecated. "
+ "The parameter will be removed in the next major version.";

private static final Set<String> allowedResponseParameters = Collections.unmodifiableSet(Stream
.concat(Collections.singleton("include_type_name").stream(), Settings.FORMAT_PARAMS.stream()).collect(Collectors.toSet()));

public RestGetIndicesAction(
final Settings settings,
final RestController controller) {
Expand Down Expand Up @@ -77,9 +83,12 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel));
}

/**
* Parameters used for controlling the response and thus might not be consumed during
* preparation of the request execution in {@link BaseRestHandler#prepareRequest(RestRequest, NodeClient)}.
*/
@Override
protected Set<String> responseParams() {
return Settings.FORMAT_PARAMS;
return allowedResponseParameters;
}

}

0 comments on commit 4a07eed

Please sign in to comment.