From 7d7da4262f4e114510b93e0a4f8a0e8775db6629 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Fri, 17 Feb 2017 14:32:31 +0100 Subject: [PATCH 1/2] Watcher: Hijack REST delete/udpate by query operations Delete/Update by query was not disabled for the watcher index on HTTP. relates elastic/x-pack-elasticsearch#586 Original commit: elastic/x-pack-elasticsearch@b41b3753799126bb63048ce2dfef39a8f1af9f54 --- .../action/RestHijackOperationAction.java | 4 +++ .../test/watcher/hijack/10_basic.yaml | 27 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestHijackOperationAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestHijackOperationAction.java index 031130084fa..f2768f3916b 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestHijackOperationAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestHijackOperationAction.java @@ -43,6 +43,10 @@ public class RestHijackOperationAction extends WatcherRestHandler { controller.registerHandler(PUT, Watch.INDEX + "/watch/_bulk", unsupportedHandler); controller.registerHandler(PUT, Watch.INDEX + "/_bulk", unsupportedHandler); controller.registerHandler(DELETE, Watch.INDEX, unsupportedHandler); + controller.registerHandler(POST, Watch.INDEX + "/_delete_by_query", unsupportedHandler); + controller.registerHandler(POST, Watch.INDEX + "/watch/_delete_by_query", unsupportedHandler); + controller.registerHandler(POST, Watch.INDEX + "/_update_by_query", unsupportedHandler); + controller.registerHandler(POST, Watch.INDEX + "/watch/_update_by_query", unsupportedHandler); } } diff --git a/plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml b/plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml index ddf39ad9aac..e30772ca0ec 100644 --- a/plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml +++ b/plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml @@ -48,7 +48,6 @@ - { "index": {}} - {} - - do: catch: /not supported/ bulk: @@ -56,3 +55,29 @@ body: - { "index": {}} - {} + + - do: + catch: /not supported/ + delete_by_query: + index: ".watches" + body: {} + + - do: + catch: /not supported/ + delete_by_query: + index: ".watches" + type: "watch" + body: {} + + - do: + catch: /not supported/ + update_by_query: + index: ".watches" + body: {} + + - do: + catch: /not supported/ + update_by_query: + index: ".watches" + type: "watch" + body: {} From d2c705206cee2d35d3d770f242bf37c2fb2e2411 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Mon, 20 Feb 2017 11:43:03 +0100 Subject: [PATCH 2/2] renamed test suite Original commit: elastic/x-pack-elasticsearch@784d5ee68a622d9874ab854df234aaaa851d939f --- .../watcher/{hijack => block_direct_index_access}/10_basic.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugin/src/test/resources/rest-api-spec/test/watcher/{hijack => block_direct_index_access}/10_basic.yaml (100%) diff --git a/plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml b/plugin/src/test/resources/rest-api-spec/test/watcher/block_direct_index_access/10_basic.yaml similarity index 100% rename from plugin/src/test/resources/rest-api-spec/test/watcher/hijack/10_basic.yaml rename to plugin/src/test/resources/rest-api-spec/test/watcher/block_direct_index_access/10_basic.yaml