diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java index 72ba598ea0209..e57fa856c7956 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateRequest.java @@ -158,7 +158,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.rawField(BODY_FIELD.getPreferredName(), stream); } } - if (indicesOptions != DEFAULT_INDICES_OPTIONS) { + if (indicesOptions.equals(DEFAULT_INDICES_OPTIONS) == false) { builder.startObject(INDICES_OPTIONS_FIELD.getPreferredName()); indicesOptions.toXContent(builder, params); builder.endObject(); diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java index 692bb2543cdfc..95fca536971d4 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherUtilsTests.java @@ -150,10 +150,10 @@ public void testSerializeSearchRequest() throws Exception { assertThat(result.getTemplate().getIdOrCode(), equalTo(expectedSource.utf8ToString())); assertThat(result.getTemplate().getType(), equalTo(ScriptType.INLINE)); } - if (expectedIndicesOptions != DEFAULT_INDICES_OPTIONS && expectedTypes != null) { + if (expectedIndicesOptions.equals(DEFAULT_INDICES_OPTIONS) == false && expectedTypes != null) { assertWarnings(IGNORE_THROTTLED_FIELD_WARNING, WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE); assertThat(result.getTypes(), arrayContainingInAnyOrder(expectedTypes)); - } else if (expectedIndicesOptions != DEFAULT_INDICES_OPTIONS) { + } else if (expectedIndicesOptions.equals(DEFAULT_INDICES_OPTIONS) == false) { assertWarnings(IGNORE_THROTTLED_FIELD_WARNING); } else if (expectedTypes != null) { assertWarnings(WatcherSearchTemplateRequest.TYPES_DEPRECATION_MESSAGE);