3333import org .elasticsearch .rest .action .RestToXContentListener ;
3434
3535import java .io .IOException ;
36+ import java .util .Collections ;
3637import java .util .Set ;
38+ import java .util .stream .Collectors ;
39+ import java .util .stream .Stream ;
3740
3841import static org .elasticsearch .rest .RestRequest .Method .GET ;
3942import static org .elasticsearch .rest .RestRequest .Method .HEAD ;
@@ -47,6 +50,9 @@ public class RestGetIndicesAction extends BaseRestHandler {
4750 static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Using `include_type_name` in get indices requests is deprecated. "
4851 + "The parameter will be removed in the next major version." ;
4952
53+ private static final Set <String > allowedResponseParameters = Collections .unmodifiableSet (Stream
54+ .concat (Collections .singleton ("include_type_name" ).stream (), Settings .FORMAT_PARAMS .stream ()).collect (Collectors .toSet ()));
55+
5056 public RestGetIndicesAction (
5157 final Settings settings ,
5258 final RestController controller ) {
@@ -77,9 +83,12 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
7783 return channel -> client .admin ().indices ().getIndex (getIndexRequest , new RestToXContentListener <>(channel ));
7884 }
7985
86+ /**
87+ * Parameters used for controlling the response and thus might not be consumed during
88+ * preparation of the request execution in {@link BaseRestHandler#prepareRequest(RestRequest, NodeClient)}.
89+ */
8090 @ Override
8191 protected Set <String > responseParams () {
82- return Settings . FORMAT_PARAMS ;
92+ return allowedResponseParameters ;
8393 }
84-
8594}
0 commit comments