File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 3838import java .io .IOException ;
3939import java .util .List ;
4040import java .util .Objects ;
41+ import java .util .Set ;
4142
4243import static org .elasticsearch .xpack .core .ClientHelper .ML_ORIGIN ;
4344import static org .elasticsearch .xpack .core .ClientHelper .executeAsyncWithOrigin ;
@@ -59,6 +60,8 @@ public class TextExpansionQueryBuilder extends AbstractQueryBuilder<TextExpansio
5960 private SetOnce <TextExpansionResults > weightedTokensSupplier ;
6061 private final TokenPruningConfig tokenPruningConfig ;
6162
63+ private static final Set <String > ALLOWED_FIELD_TYPES = Set .of ("sparse_vector" , "rank_features" );
64+
6265 private static final DeprecationLogger deprecationLogger = DeprecationLogger .getLogger (ParseField .class );
6366 public static final String TEXT_EXPANSION_DEPRECATION_MESSAGE = NAME + " is deprecated. Use sparse_vector instead." ;
6467
@@ -158,6 +161,8 @@ protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) {
158161 return weightedTokensToQuery (fieldName , weightedTokensSupplier .get ());
159162 }
160163
164+ // Do field type check if query won't be rewritten as a WeightedTokensQuery
165+
161166 CoordinatedInferenceAction .Request inferRequest = CoordinatedInferenceAction .Request .forTextInput (
162167 modelId ,
163168 List .of (modelText ),
You can’t perform that action at this time.
0 commit comments