diff --git a/server/src/main/java/org/elasticsearch/common/lucene/search/MultiPhrasePrefixQuery.java b/server/src/main/java/org/elasticsearch/common/lucene/search/MultiPhrasePrefixQuery.java index 87895bc91129c..99d705eece950 100644 --- a/server/src/main/java/org/elasticsearch/common/lucene/search/MultiPhrasePrefixQuery.java +++ b/server/src/main/java/org/elasticsearch/common/lucene/search/MultiPhrasePrefixQuery.java @@ -97,7 +97,7 @@ public void add(Term[] terms) { */ public void add(Term[] terms, int position) { for (int i = 0; i < terms.length; i++) { - if (terms[i].field() != field) { + if (Objects.equals(terms[i].field(), field) == false) { throw new IllegalArgumentException( "All phrase terms must be in the same field (" + field + "): " + terms[i]); diff --git a/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java b/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java index 50f3e9092bc7f..46c59ef1037ff 100644 --- a/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java +++ b/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/index/IndexResolver.java @@ -710,7 +710,7 @@ private static Map getInvalidFieldsForAliases(String // iterate over each type for (Entry type : types.entrySet()) { String esFieldType = type.getKey(); - if (esFieldType == UNMAPPED) { + if (Objects.equals(esFieldType, UNMAPPED)) { continue; } String[] indices = type.getValue().indices(); @@ -749,7 +749,7 @@ private static Map getInvalidFieldsForAliases(String } else { // if the field type is the same across all this alias' indices, check the field's capabilities (searchable/aggregatable) for (Entry type : types.entrySet()) { - if (type.getKey() == UNMAPPED) { + if (Objects.equals(type.getKey(), UNMAPPED)) { continue; } FieldCapabilities f = type.getValue();