Skip to content

Commit

Permalink
[Rest Api Compatibility] REST Terms vector typed response (#73117)
Browse files Browse the repository at this point in the history
Enabling the tests and adds a type field for termvector response
the commit that enabled typed endpoints but missed to update the response
#72155
  • Loading branch information
pgomulka authored May 19, 2021
1 parent 4b2c3ab commit 35460a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 5 additions & 8 deletions rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ tasks.named("yamlRestCompatTest").configure {
// there is a small distinction between empty mappings and no mappings at all. The code to implement this test was refactored #54003
// field search on _type field- not implementing. The data for _type is considered incorrect in this search
'search/160_exists_query/Test exists query on _type field',
// 83 - 12 = 71 tests won't be fixed
//type information is not stored, hence the the index will be found
'termvectors/50_mix_typeless_typeful/Term vectors with typeless API on an index that has types',
// 85 - 13 = 72 tests won't be fixed
'bulk/11_basic_with_types/Array of objects',
'bulk/11_basic_with_types/Empty _id',
'bulk/11_basic_with_types/Empty _id with op_type create',
Expand Down Expand Up @@ -218,13 +220,8 @@ tasks.named("yamlRestCompatTest").configure {
'snapshot.get/10_basic/Get snapshot info when verbose is false',
'snapshot.get/10_basic/Get snapshot info with metadata',
'snapshot.get/10_basic/Get snapshot info with index details',
'suggest/20_completion/Suggestions with source should work',
'termvectors/11_basic_with_types/Basic tests for termvector get',
'termvectors/20_issue7121/Term vector API should return \'found: false\' for docs between index and refresh',
'termvectors/21_issue7121_with_types/Term vector API should return \'found: false\' for docs between index and refresh',
'termvectors/31_realtime_with_types/Realtime Term Vectors',
'termvectors/50_mix_typeless_typeful/Term vectors with typeless API on an index that has types'
].join(',')
'suggest/20_completion/Suggestions with source should work'
].join(',')
}

tasks.named("transformV7RestTests").configure({ task ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.termvectors.TermVectorsRequest.Flag;
import org.elasticsearch.common.RestApiVersion;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
Expand Down Expand Up @@ -170,6 +171,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
if (isArtificial() == false) {
builder.field(FieldStrings._ID, id);
}
if(builder.getRestApiVersion() == RestApiVersion.V_7) {
builder.field(MapperService.TYPE_FIELD_NAME, MapperService.SINGLE_MAPPING_NAME);
}
builder.field(FieldStrings._VERSION, docVersion);
builder.field(FieldStrings.FOUND, isExists());
builder.field(FieldStrings.TOOK, tookInMillis);
Expand Down

0 comments on commit 35460a5

Please sign in to comment.