diff --git a/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java index 8336b09bdb818..49e5d104ab310 100644 --- a/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/IpFieldMapper.java @@ -257,11 +257,15 @@ public Query termQuery(Object value, @Nullable QueryShardContext context) { private Query indexOrDvQuery(Query pointQuery, Query dvQuery) { if (isSearchable() && hasDocValues()) { + assert pointQuery!=null; + assert dvQuery!=null; return new IndexOrDocValuesQuery(pointQuery, dvQuery); } else { if (isSearchable()) { + assert pointQuery!=null; return pointQuery; } else { + assert dvQuery!=null; return dvQuery; } }