diff --git a/watcher/pom.xml b/watcher/pom.xml
index cca4654291b..21979a9bd40 100644
--- a/watcher/pom.xml
+++ b/watcher/pom.xml
@@ -122,6 +122,28 @@
test/**/*.yaml
+
+
+ ${elasticsearch.tools.directory}/rest-api-spec
+ rest-api-spec
+
+
+ api/info.json
+ api/cluster.health.json
+ api/cluster.state.json
+
+ api/index.json
+ api/get.json
+ api/delete.json
+ api/delete-by-query.json
+ api/bulk.json
+ api/update.json
+ api/search.json
+ api/indices.delete.json
+ api/indices.refresh.json
+
+
diff --git a/watcher/rest-api-spec/api/bulk.json b/watcher/rest-api-spec/api/bulk.json
deleted file mode 100644
index a5c62854ca1..00000000000
--- a/watcher/rest-api-spec/api/bulk.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "bulk": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["POST", "PUT"],
- "url": {
- "path": "/_bulk",
- "paths": ["/_bulk", "/{index}/_bulk", "/{index}/{type}/_bulk"],
- "parts": {
- "index": {
- "type" : "string",
- "description" : "Default index for items which don't provide one"
- },
- "type": {
- "type" : "string",
- "description" : "Default document type for items which don't provide one"
- }
- },
- "params": {
- "consistency": {
- "type" : "enum",
- "options" : ["one", "quorum", "all"],
- "description" : "Explicit write consistency setting for the operation"
- },
- "refresh": {
- "type" : "boolean",
- "description" : "Refresh the index after performing the operation"
- },
- "replication": {
- "type" : "enum",
- "options" : ["sync","async"],
- "default" : "sync",
- "description" : "Explicitely set the replication type"
- },
- "routing": {
- "type" : "string",
- "description" : "Specific routing value"
- },
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- },
- "type": {
- "type" : "string",
- "description" : "Default document type for items which don't provide one"
- }
- }
- },
- "body": {
- "description" : "The operation definition and data (action-data pairs), separated by newlines",
- "required" : true,
- "serialize" : "bulk"
- }
- }
-}
diff --git a/watcher/rest-api-spec/api/cluster.health.json b/watcher/rest-api-spec/api/cluster.health.json
deleted file mode 100644
index a185d63948e..00000000000
--- a/watcher/rest-api-spec/api/cluster.health.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "cluster.health": {
- "documentation": "This file is copied from es core because the REST test framework requires it",
- "methods": ["GET"],
- "url": {
- "path": "/_cluster/health",
- "paths": ["/_cluster/health", "/_cluster/health/{index}"],
- "parts": {
- "index": {
- "type" : "string",
- "description" : "Limit the information returned to a specific index"
- }
- },
- "params": {
- "level": {
- "type" : "enum",
- "options" : ["cluster","indices","shards"],
- "default" : "cluster",
- "description" : "Specify the level of detail for returned information"
- },
- "local": {
- "type" : "boolean",
- "description" : "Return local information, do not retrieve the state from master node (default: false)"
- },
- "master_timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout for connection to master node"
- },
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- },
- "wait_for_active_shards": {
- "type" : "number",
- "description" : "Wait until the specified number of shards is active"
- },
- "wait_for_nodes": {
- "type" : "string",
- "description" : "Wait until the specified number of nodes is available"
- },
- "wait_for_relocating_shards": {
- "type" : "number",
- "description" : "Wait until the specified number of relocating shards is finished"
- },
- "wait_for_status": {
- "type" : "enum",
- "options" : ["green","yellow","red"],
- "default" : null,
- "description" : "Wait until cluster is in a specific state"
- }
- }
- },
- "body": null
- }
-}
diff --git a/watcher/rest-api-spec/api/delete.json b/watcher/rest-api-spec/api/delete.json
deleted file mode 100644
index 893ec96c0e2..00000000000
--- a/watcher/rest-api-spec/api/delete.json
+++ /dev/null
@@ -1,66 +0,0 @@
-{
- "delete": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["DELETE"],
- "url": {
- "path": "/{index}/{type}/{id}",
- "paths": ["/{index}/{type}/{id}"],
- "parts": {
- "id": {
- "type" : "string",
- "required" : true,
- "description" : "The document ID"
- },
- "index": {
- "type" : "string",
- "required" : true,
- "description" : "The name of the index"
- },
- "type": {
- "type" : "string",
- "required" : true,
- "description" : "The type of the document"
- }
- },
- "params": {
- "consistency": {
- "type" : "enum",
- "options" : ["one", "quorum", "all"],
- "description" : "Specific write consistency setting for the operation"
- },
- "parent": {
- "type" : "string",
- "description" : "ID of parent document"
- },
- "refresh": {
- "type" : "boolean",
- "description" : "Refresh the index after performing the operation"
- },
- "replication": {
- "type" : "enum",
- "options" : ["sync","async"],
- "default" : "sync",
- "description" : "Specific replication type"
- },
- "routing": {
- "type" : "string",
- "description" : "Specific routing value"
- },
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- },
- "version" : {
- "type" : "number",
- "description" : "Explicit version number for concurrency control"
- },
- "version_type": {
- "type" : "enum",
- "options" : ["internal", "external", "external_gte", "force"],
- "description" : "Specific version type"
- }
- }
- },
- "body": null
- }
-}
diff --git a/watcher/rest-api-spec/api/delete_by_query.json b/watcher/rest-api-spec/api/delete_by_query.json
deleted file mode 100644
index c05c2a755db..00000000000
--- a/watcher/rest-api-spec/api/delete_by_query.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
- "delete_by_query": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["DELETE"],
- "url": {
- "path": "/{index}/_query",
- "paths": ["/{index}/_query", "/{index}/{type}/_query"],
- "parts": {
- "index": {
- "type" : "list",
- "required": true,
- "description" : "A comma-separated list of indices to restrict the operation; use `_all` to perform the operation on all indices"
- },
- "type": {
- "type" : "list",
- "description" : "A comma-separated list of types to restrict the operation"
- }
- },
- "params": {
- "analyzer": {
- "type" : "string",
- "description" : "The analyzer to use for the query string"
- },
- "consistency": {
- "type" : "enum",
- "options" : ["one", "quorum", "all"],
- "description" : "Specific write consistency setting for the operation"
- },
- "default_operator": {
- "type" : "enum",
- "options" : ["AND","OR"],
- "default" : "OR",
- "description" : "The default operator for query string query (AND or OR)"
- },
- "df": {
- "type" : "string",
- "description" : "The field to use as default where no field prefix is given in the query string"
- },
- "ignore_unavailable": {
- "type" : "boolean",
- "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)"
- },
- "allow_no_indices": {
- "type" : "boolean",
- "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"
- },
- "expand_wildcards": {
- "type" : "enum",
- "options" : ["open","closed","none","all"],
- "default" : "open",
- "description" : "Whether to expand wildcard expression to concrete indices that are open, closed or both."
- },
- "replication": {
- "type" : "enum",
- "options" : ["sync","async"],
- "default" : "sync",
- "description" : "Specific replication type"
- },
- "q": {
- "type" : "string",
- "description" : "Query in the Lucene query string syntax"
- },
- "routing": {
- "type" : "string",
- "description" : "Specific routing value"
- },
- "source": {
- "type" : "string",
- "description" : "The URL-encoded query definition (instead of using the request body)"
- },
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- }
- }
- },
- "body": {
- "description" : "A query to restrict the operation specified with the Query DSL"
- }
- }
-}
diff --git a/watcher/rest-api-spec/api/get.json b/watcher/rest-api-spec/api/get.json
deleted file mode 100644
index 774967d649b..00000000000
--- a/watcher/rest-api-spec/api/get.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "get": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["GET"],
- "url": {
- "path": "/{index}/{type}/{id}",
- "paths": ["/{index}/{type}/{id}"],
- "parts": {
- "id": {
- "type" : "string",
- "required" : true,
- "description" : "The document ID"
- },
- "index": {
- "type" : "string",
- "required" : true,
- "description" : "The name of the index"
- },
- "type": {
- "type" : "string",
- "required" : true,
- "description" : "The type of the document (use `_all` to fetch the first document matching the ID across all types)"
- }
- },
- "params": {
- "fields": {
- "type": "list",
- "description" : "A comma-separated list of fields to return in the response"
- },
- "parent": {
- "type" : "string",
- "description" : "The ID of the parent document"
- },
- "preference": {
- "type" : "string",
- "description" : "Specify the node or shard the operation should be performed on (default: random)"
- },
- "realtime": {
- "type" : "boolean",
- "description" : "Specify whether to perform the operation in realtime or search mode"
- },
- "refresh": {
- "type" : "boolean",
- "description" : "Refresh the shard containing the document before performing the operation"
- },
- "routing": {
- "type" : "string",
- "description" : "Specific routing value"
- },
- "_source": {
- "type" : "list",
- "description" : "True or false to return the _source field or not, or a list of fields to return"
- },
- "_source_exclude": {
- "type" : "list",
- "description" : "A list of fields to exclude from the returned _source field"
- },
- "_source_include": {
- "type" : "list",
- "description" : "A list of fields to extract and return from the _source field"
- },
- "version" : {
- "type" : "number",
- "description" : "Explicit version number for concurrency control"
- },
- "version_type": {
- "type" : "enum",
- "options" : ["internal", "external", "external_gte", "force"],
- "description" : "Specific version type"
- }
- }
- },
- "body": null
- }
-}
diff --git a/watcher/rest-api-spec/api/index.json b/watcher/rest-api-spec/api/index.json
deleted file mode 100644
index b87e045ecde..00000000000
--- a/watcher/rest-api-spec/api/index.json
+++ /dev/null
@@ -1,82 +0,0 @@
-{
- "index": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["POST", "PUT"],
- "url": {
- "path": "/{index}/{type}",
- "paths": ["/{index}/{type}", "/{index}/{type}/{id}"],
- "parts": {
- "id": {
- "type" : "string",
- "description" : "Document ID"
- },
- "index": {
- "type" : "string",
- "required" : true,
- "description" : "The name of the index"
- },
- "type": {
- "type" : "string",
- "required" : true,
- "description" : "The type of the document"
- }
- },
- "params": {
- "consistency": {
- "type" : "enum",
- "options" : ["one", "quorum", "all"],
- "description" : "Explicit write consistency setting for the operation"
- },
- "op_type": {
- "type" : "enum",
- "options" : ["index", "create"],
- "default" : "index",
- "description" : "Explicit operation type"
- },
- "parent": {
- "type" : "string",
- "description" : "ID of the parent document"
- },
- "refresh": {
- "type" : "boolean",
- "description" : "Refresh the index after performing the operation"
- },
- "replication": {
- "type" : "enum",
- "options" : ["sync","async"],
- "default" : "sync",
- "description" : "Specific replication type"
- },
- "routing": {
- "type" : "string",
- "description" : "Specific routing value"
- },
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- },
- "timestamp": {
- "type" : "time",
- "description" : "Explicit timestamp for the document"
- },
- "ttl": {
- "type" : "duration",
- "description" : "Expiration time for the document"
- },
- "version" : {
- "type" : "number",
- "description" : "Explicit version number for concurrency control"
- },
- "version_type": {
- "type" : "enum",
- "options" : ["internal", "external", "external_gte", "force"],
- "description" : "Specific version type"
- }
- }
- },
- "body": {
- "description" : "The document",
- "required" : true
- }
- }
-}
diff --git a/watcher/rest-api-spec/api/indices.delete.json b/watcher/rest-api-spec/api/indices.delete.json
deleted file mode 100644
index 7db198e1537..00000000000
--- a/watcher/rest-api-spec/api/indices.delete.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "indices.delete": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["DELETE"],
- "url": {
- "path": "/{index}",
- "paths": ["/{index}"],
- "parts": {
- "index": {
- "type" : "list",
- "required" : true,
- "description" : "A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices"
- }
- },
- "params": {
- "timeout": {
- "type" : "time",
- "description" : "Explicit operation timeout"
- },
- "master_timeout": {
- "type" : "time",
- "description" : "Specify timeout for connection to master"
- }
- }
- },
- "body": null
- }
-}
diff --git a/watcher/rest-api-spec/api/info.json b/watcher/rest-api-spec/api/info.json
deleted file mode 100644
index fd8557e15f4..00000000000
--- a/watcher/rest-api-spec/api/info.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "info": {
- "documentation": "This file is copied from es core because the REST test framework requires it",
- "methods": ["GET"],
- "url": {
- "path": "/",
- "paths": ["/"],
- "parts": {
- },
- "params": {
- }
- },
- "body": null
- }
-}
diff --git a/watcher/rest-api-spec/api/update.json b/watcher/rest-api-spec/api/update.json
deleted file mode 100644
index 9df27493e90..00000000000
--- a/watcher/rest-api-spec/api/update.json
+++ /dev/null
@@ -1,98 +0,0 @@
-{
- "update": {
- "documentation": "This file is copied from es core just to verify that the .watches api hijacking works",
- "methods": ["POST"],
- "url": {
- "path": "/{index}/{type}/{id}/_update",
- "paths": ["/{index}/{type}/{id}/_update"],
- "parts": {
- "id": {
- "type": "string",
- "required": true,
- "description": "Document ID"
- },
- "index": {
- "type": "string",
- "required": true,
- "description": "The name of the index"
- },
- "type": {
- "type": "string",
- "required": true,
- "description": "The type of the document"
- }
- },
- "params": {
- "consistency": {
- "type": "enum",
- "options": ["one", "quorum", "all"],
- "description": "Explicit write consistency setting for the operation"
- },
- "fields": {
- "type": "list",
- "description": "A comma-separated list of fields to return in the response"
- },
- "lang": {
- "type": "string",
- "description": "The script language (default: groovy)"
- },
- "parent": {
- "type": "string",
- "description": "ID of the parent document"
- },
- "refresh": {
- "type": "boolean",
- "description": "Refresh the index after performing the operation"
- },
- "replication": {
- "type": "enum",
- "options": ["sync", "async"],
- "default": "sync",
- "description": "Specific replication type"
- },
- "retry_on_conflict": {
- "type": "number",
- "description": "Specify how many times should the operation be retried when a conflict occurs (default: 0)"
- },
- "routing": {
- "type": "string",
- "description": "Specific routing value"
- },
- "script": {
- "description": "The URL-encoded script definition (instead of using request body)"
- },
- "script_id": {
- "description": "The id of a stored script"
- },
- "scripted_upsert": {
- "type": "boolean",
- "description": "True if the script referenced in script or script_id should be called to perform inserts - defaults to false"
- },
- "timeout": {
- "type": "time",
- "description": "Explicit operation timeout"
- },
- "timestamp": {
- "type": "time",
- "description": "Explicit timestamp for the document"
- },
- "ttl": {
- "type": "duration",
- "description": "Expiration time for the document"
- },
- "version": {
- "type": "number",
- "description": "Explicit version number for concurrency control"
- },
- "version_type": {
- "type": "enum",
- "options": ["internal", "force"],
- "description": "Specific version type"
- }
- }
- },
- "body": {
- "description": "The request definition using either `script` or partial `doc`"
- }
- }
-}