Watcher: Remove handling of _status field (elastic/x-pack-elasticsearch#1701)

There is no need to handle any _status field in
the 6.0 release from now on, as everything has been
taken care in the upgrade API.

Original commit: elastic/x-pack-elasticsearch@606581f4d7
This commit is contained in:
Alexander Reelsen 2017-06-14 10:36:46 +02:00 committed by GitHub
parent e7af52fb8e
commit 457af97d1f
4 changed files with 2 additions and 21 deletions

View File

@ -303,7 +303,7 @@ public class Watch implements ToXContentObject {
actions = actionRegistry.parseActions(id, parser); actions = actionRegistry.parseActions(id, parser);
} else if (Field.METADATA.match(currentFieldName)) { } else if (Field.METADATA.match(currentFieldName)) {
metatdata = parser.map(); metatdata = parser.map();
} else if (Field.STATUS.match(currentFieldName) || Field.STATUS_V5.match(currentFieldName)) { } else if (Field.STATUS.match(currentFieldName)) {
if (includeStatus) { if (includeStatus) {
status = WatchStatus.parse(id, parser, clock); status = WatchStatus.parse(id, parser, clock);
} else { } else {
@ -350,7 +350,6 @@ public class Watch implements ToXContentObject {
ParseField THROTTLE_PERIOD_HUMAN = new ParseField("throttle_period"); ParseField THROTTLE_PERIOD_HUMAN = new ParseField("throttle_period");
ParseField METADATA = new ParseField("metadata"); ParseField METADATA = new ParseField("metadata");
ParseField STATUS = new ParseField("status"); ParseField STATUS = new ParseField("status");
ParseField STATUS_V5 = new ParseField("_status");
} }
private static final Pattern NO_WS_PATTERN = Pattern.compile("\\S+"); private static final Pattern NO_WS_PATTERN = Pattern.compile("\\S+");

View File

@ -98,11 +98,6 @@
"state": { "state": {
"type": "keyword" "type": "keyword"
}, },
"_status": {
"type": "object",
"enabled" : false,
"dynamic" : true
},
"status": { "status": {
"type": "object", "type": "object",
"enabled" : false, "enabled" : false,

View File

@ -10,11 +10,6 @@
"doc": { "doc": {
"dynamic" : "strict", "dynamic" : "strict",
"properties": { "properties": {
"_status": {
"type": "object",
"enabled" : false,
"dynamic" : true
},
"status": { "status": {
"type": "object", "type": "object",
"enabled" : false, "enabled" : false,

View File

@ -249,15 +249,7 @@ public class WatchTests extends ESTestCase {
WatchStatus watchStatus = new WatchStatus(new DateTime(clock.millis()), unmodifiableMap(actionsStatuses)); WatchStatus watchStatus = new WatchStatus(new DateTime(clock.millis()), unmodifiableMap(actionsStatuses));
Watch.Parser watchParser = new Watch.Parser(settings, triggerService, actionRegistry, inputRegistry, null, clock); Watch.Parser watchParser = new Watch.Parser(settings, triggerService, actionRegistry, inputRegistry, null, clock);
XContentBuilder builder = jsonBuilder().startObject() XContentBuilder builder = jsonBuilder().startObject().startObject("trigger").endObject().field("status", watchStatus).endObject();
.startObject("trigger").endObject();
if (randomBoolean()) {
builder.field("_status", watchStatus);
} else {
builder.field("status", watchStatus);
}
builder.endObject();
Watch watch = watchParser.parse("foo", true, builder.bytes(), XContentType.JSON); Watch watch = watchParser.parse("foo", true, builder.bytes(), XContentType.JSON);
assertThat(watch.status().state().getTimestamp().getMillis(), is(clock.millis())); assertThat(watch.status().state().getTimestamp().getMillis(), is(clock.millis()));
for (ActionWrapper action : actions) { for (ActionWrapper action : actions) {