Browse Source

REST: Remove GET support for clear cache indices (#29525)

Clearing the cache indices can be done via GET and POST. As GET should
only support read only operations, this removes the support for using
GET for clearing the indices caches.
Alexander Reelsen 7 years ago
parent
commit
e1a16a6018

+ 4 - 1
docs/reference/release-notes/7.0.0-alpha1.asciidoc

@@ -8,4 +8,7 @@ The changes listed below have been released for the first time in Elasticsearch
 === Breaking changes
 
 Core::
-* Tribe node has been removed in favor of Cross-Cluster-Search
+* Tribe node has been removed in favor of Cross-Cluster-Search
+
+Rest API::
+* The Clear Cache API only supports `POST` as HTTP method

+ 1 - 1
rest-api-spec/src/main/resources/rest-api-spec/api/indices.clear_cache.json

@@ -1,7 +1,7 @@
 {
   "indices.clear_cache": {
     "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html",
-    "methods": ["POST", "GET"],
+    "methods": ["POST"],
     "url": {
       "path": "/_cache/clear",
       "paths": ["/_cache/clear", "/{index}/_cache/clear"],

+ 0 - 4
server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java

@@ -31,7 +31,6 @@ import org.elasticsearch.rest.action.RestToXContentListener;
 
 import java.io.IOException;
 
-import static org.elasticsearch.rest.RestRequest.Method.GET;
 import static org.elasticsearch.rest.RestRequest.Method.POST;
 
 public class RestClearIndicesCacheAction extends BaseRestHandler {
@@ -40,9 +39,6 @@ public class RestClearIndicesCacheAction extends BaseRestHandler {
         super(settings);
         controller.registerHandler(POST, "/_cache/clear", this);
         controller.registerHandler(POST, "/{index}/_cache/clear", this);
-
-        controller.registerHandler(GET, "/_cache/clear", this);
-        controller.registerHandler(GET, "/{index}/_cache/clear", this);
     }
 
     @Override