diff --git a/server/src/main/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilder.java index 88d3910d31b..ebc451a4493 100644 --- a/server/src/main/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilder.java @@ -48,7 +48,7 @@ import java.io.IOException; import java.util.Objects; public class FieldMaskingSpanQueryBuilder extends AbstractQueryBuilder implements SpanQueryBuilder { - public static final String NAME = "field_masking_span"; + public static final ParseField SPAN_FIELD_MASKING_FIELD = new ParseField("span_field_masking", "field_masking_span"); private static final ParseField FIELD_FIELD = new ParseField("field"); private static final ParseField QUERY_FIELD = new ParseField("query"); @@ -105,7 +105,7 @@ public class FieldMaskingSpanQueryBuilder extends AbstractQueryBuilder( - FieldMaskingSpanQueryBuilder.NAME, + FieldMaskingSpanQueryBuilder.SPAN_FIELD_MASKING_FIELD, FieldMaskingSpanQueryBuilder::new, FieldMaskingSpanQueryBuilder::fromXContent ) diff --git a/server/src/test/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilderTests.java b/server/src/test/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilderTests.java index 88ac55fee73..10d4a7918fb 100644 --- a/server/src/test/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilderTests.java +++ b/server/src/test/java/org/opensearch/index/query/FieldMaskingSpanQueryBuilderTests.java @@ -38,6 +38,7 @@ import org.opensearch.test.AbstractQueryTestCase; import java.io.IOException; +import static org.opensearch.index.query.FieldMaskingSpanQueryBuilder.SPAN_FIELD_MASKING_FIELD; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.instanceOf; @@ -73,7 +74,9 @@ public class FieldMaskingSpanQueryBuilderTests extends AbstractQueryTestCase registeredNonDeprecated = module.getNamedXContents() .stream() .filter(e -> e.categoryClass.equals(QueryBuilder.class)) - .filter(e -> e.name.getDeprecatedNames().length == 0) + .filter(e -> e.name.getAllReplacedWith() == null) .map(e -> e.name.getPreferredName()) .collect(toSet()); Set registeredAll = module.getNamedXContents() @@ -422,7 +422,6 @@ public class SearchModuleTests extends OpenSearchTestCase { "constant_score", "dis_max", "exists", - "field_masking_span", "function_score", "fuzzy", "geo_bounding_box", @@ -448,6 +447,7 @@ public class SearchModuleTests extends OpenSearchTestCase { "script_score", "simple_query_string", "span_containing", + "span_field_masking", "span_first", "span_gap", "span_multi", @@ -465,7 +465,7 @@ public class SearchModuleTests extends OpenSearchTestCase { "distance_feature" }; // add here deprecated queries to make sure we log a deprecation warnings when they are used - private static final String[] DEPRECATED_QUERIES = new String[] { "common" }; + private static final String[] DEPRECATED_QUERIES = new String[] { "common", "field_masking_span" }; /** * Dummy test {@link AggregationBuilder} used to test registering aggregation builders.