From 6878c0121fb471be4e4dc7ef6a7f78256a1998d7 Mon Sep 17 00:00:00 2001 From: zhichao-aws Date: Mon, 25 Sep 2023 20:52:25 +0800 Subject: [PATCH] null check Signed-off-by: zhichao-aws --- .../neuralsearch/query/SparseEncodingQueryBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java b/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java index f75a56b50..3da98a186 100644 --- a/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java +++ b/src/main/java/org/opensearch/neuralsearch/query/SparseEncodingQueryBuilder.java @@ -266,7 +266,7 @@ private static void validateForRewrite(String queryText, String modelId) { } private static void validateFieldType(MappedFieldType fieldType) { - if (!fieldType.typeName().equals("rank_features")) { + if (null == fieldType || !fieldType.typeName().equals("rank_features")) { throw new IllegalArgumentException( "[" + NAME + "] query only works on [rank_features] fields, " + "not [" + fieldType.typeName() + "]" );