Skip to content

Commit 90f2271

Browse files
authored
[Rest Api Compatibility] Typed TermLookups (#74544)
Previously removed in #46943 parsing type field in term lookup is now possible with rest compatible api. The type field is ignored relates main meta issue #51816 relates type removal meta issue #54160
1 parent 4ab100b commit 90f2271

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rest-api-spec/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ tasks.named("yamlRestCompatTest").configure {
106106
'mtermvectors/11_basic_with_types/Basic tests for multi termvector get',
107107
'mtermvectors/21_deprecated_with_types/Deprecated camel case and _ parameters should fail in Term Vectors query',
108108
'mtermvectors/30_mix_typeless_typeful/mtermvectors without types on an index that has types',
109-
'search/150_rewrite_on_coordinator/Ensure that we fetch the document only once', //terms_lookup
110-
'search/171_terms_query_with_types/Terms Query with No.of terms exceeding index.max_terms_count should FAIL', //bulk
111109
'search/260_parameter_validation/test size=-1 is deprecated', //size=-1 change
112110
'search/310_match_bool_prefix/multi_match multiple fields with cutoff_frequency throws exception', //cutoff_frequency
113111
'search/340_type_query/type query', // type_query - probably should behave like match_all

server/src/main/java/org/elasticsearch/indices/TermsLookup.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
import org.elasticsearch.common.xcontent.ToXContentFragment;
1818
import org.elasticsearch.common.xcontent.XContentBuilder;
1919
import org.elasticsearch.common.xcontent.XContentParser;
20+
import org.elasticsearch.core.RestApiVersion;
2021
import org.elasticsearch.index.mapper.MapperService;
2122
import org.elasticsearch.index.query.TermsQueryBuilder;
2223

2324
import java.io.IOException;
2425
import java.util.Objects;
2526

2627
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
28+
import static org.elasticsearch.core.RestApiVersion.equalTo;
2729

2830
/**
2931
* Encapsulates the parameters needed to fetch terms.
@@ -107,6 +109,8 @@ public TermsLookup routing(String routing) {
107109
PARSER.declareString(constructorArg(), new ParseField("id"));
108110
PARSER.declareString(constructorArg(), new ParseField("path"));
109111
PARSER.declareString(TermsLookup::routing, new ParseField("routing"));
112+
PARSER.declareString((termLookup,type)-> {}, new ParseField("type")
113+
.forRestApiVersion(equalTo(RestApiVersion.V_7)));
110114
}
111115

112116
public static TermsLookup parseTermsLookup(XContentParser parser) throws IOException {

0 commit comments

Comments
 (0)