Disallow {index} being specified at the top level of _xpack/monitoring/_bulk

The general use case is to provide only the {type} to the bulk and even that may not be specified. However,
by setting it up as

/_x-pack/monitoring/{type}/_bulk
/_x-pack/monitoring/{index}/{type}/_bulk

it fails to properly recognize the {type} parameter because the PathTrie that gets generated sees two wildcards
at the same location and the last one specified wins -- {index}. As a result, it's impossible to only set the
{type} without making the PathTrie logic convoluted for a niche use case (a list to try instead of a single path).

his fixes the issue by removing the completely unused option: you can no longer specify {index} outside of
individual bulk indexing operations. If we see a need to bring it back, then we can add it as an API param, but
that is an unusual place for the index field and I do not expect it to be needed that frequently.

Original commit: elastic/x-pack-elasticsearch@40d0d05404
This commit is contained in:
Chris Earle 2016-05-13 17:58:59 -04:00
parent d610c02a6d
commit 73ba90b863
3 changed files with 4 additions and 7 deletions

View File

@ -38,8 +38,6 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
controller.registerHandler(PUT, URI_BASE + "/_bulk", this);
controller.registerHandler(POST, URI_BASE + "/{type}/_bulk", this);
controller.registerHandler(PUT, URI_BASE + "/{type}/_bulk", this);
controller.registerHandler(POST, URI_BASE + "/{index}/{type}/_bulk", this);
controller.registerHandler(PUT, URI_BASE + "/{index}/{type}/_bulk", this);
}
@Override

View File

@ -13,6 +13,9 @@
"xpack.version": "${project.version}"
}
},
"kibana": {
"enabled": false
},
"node": {
"enabled": false
}

View File

@ -4,12 +4,8 @@
"methods": ["POST", "PUT"],
"url": {
"path": "/_x-pack/monitoring/_bulk",
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{index}/_bulk", "/_x-pack/monitoring/{index}/{type}/_bulk"],
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{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"