Skip to content

Commit 71fd71a

Browse files
committed
Include Index, Type, Id and Took on TermVectorsResponse
Fixes #1866
1 parent 0b7a2c5 commit 71fd71a

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

Diff for: src/Nest/Document/Multiple/MultiTermVectors/MultiTermVectorsResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public interface IMultiTermVectorsResponse : IResponse
1212
public class MultiTermVectorsResponse : ResponseBase, IMultiTermVectorsResponse
1313
{
1414
[JsonProperty("docs")]
15-
public IEnumerable<TermVectorsResponse> Documents { get; internal set; }= new List<TermVectorsResponse>();
15+
public IEnumerable<TermVectorsResponse> Documents { get; internal set; } = new List<TermVectorsResponse>();
1616
}
1717
}

Diff for: src/Nest/Document/Single/TermVectors/TermVectorsResponse.cs

+20
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,36 @@ namespace Nest
55
{
66
public interface ITermVectorsResponse : IResponse
77
{
8+
string Index { get; }
9+
string Type { get; }
10+
string Id { get; }
11+
long Version { get; }
812
bool Found { get; }
13+
int Took { get; }
914
IDictionary<string, TermVector> TermVectors { get; }
1015
}
1116

1217
[JsonObject]
1318
public class TermVectorsResponse : ResponseBase, ITermVectorsResponse
1419
{
20+
[JsonProperty("_index")]
21+
public string Index { get; internal set; }
22+
23+
[JsonProperty("_type")]
24+
public string Type { get; internal set; }
25+
26+
[JsonProperty("_id")]
27+
public string Id { get; internal set; }
28+
29+
[JsonProperty("_version")]
30+
public long Version { get; internal set; }
31+
1532
[JsonProperty("found")]
1633
public bool Found { get; internal set; }
1734

35+
[JsonProperty(PropertyName = "took")]
36+
public int Took { get; internal set; }
37+
1838
[JsonProperty("term_vectors")]
1939
public IDictionary<string, TermVector> TermVectors { get; internal set; } = new Dictionary<string, TermVector>();
2040
}

Diff for: src/Tests/Document/Multiple/MultiTermVectors/MultiTermVectorsApiTests.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ protected override LazyResponses ClientUsage() => Calls(
4848

4949
protected override void ExpectResponse(IMultiTermVectorsResponse response)
5050
{
51-
response.Documents.Should().NotBeEmpty().And.HaveCount(2).And.OnlyContain(d => d.Found);
51+
response.Documents.Should().NotBeEmpty().And.HaveCount(2).And.OnlyContain(d => d.Found).And.OnlyContain(d => d.IsValid);
5252
var termvectorDoc = response.Documents.FirstOrDefault(d => d.TermVectors.Count > 0);
53+
5354
termvectorDoc.Should().NotBeNull();
55+
termvectorDoc.Index.Should().NotBeNull();
56+
termvectorDoc.Type.Should().NotBeNull();
57+
termvectorDoc.Id.Should().NotBeNull();
58+
termvectorDoc.Took.Should().BeGreaterThan(0);
5459

5560
termvectorDoc.TermVectors.Should().NotBeEmpty().And.ContainKey("firstName");
5661
var vectors = termvectorDoc.TermVectors["firstName"];

Diff for: src/Tests/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# mode either u (unit test), i (integration test) or m (mixed mode)
2-
mode: u
2+
mode: m
33
# the elasticsearch version that should be started
44
elasticsearch_version: 2.0.1
55
# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running

0 commit comments

Comments
 (0)