Skip to content

Commit

Permalink
[Rest Api Compatibility] REST Terms vector typed response
Browse files Browse the repository at this point in the history
enabeling the tests and adds a type field for termvector response
the commit that enabled typed enpoints but missed to update the response
elastic#72155
  • Loading branch information
pgomulka committed May 14, 2021
1 parent 0071ea2 commit 120b9d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 3 additions & 6 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 @@ -219,11 +221,6 @@ tasks.named("yamlRestCompatTest").configure {
'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(',')
}

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 120b9d9

Please sign in to comment.