Skip to content

Adding took time to _msearch #3841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Nest/Search/MultiSearch/MultiSearchResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class MultiSearchResponse : ResponseBase
{
public MultiSearchResponse() => Responses = new Dictionary<string, IResponse>();

public long Took { get; set; }

public IEnumerable<IResponse> AllResponses => _allResponses<IResponse>();

public override bool IsValid => base.IsValid && AllResponses.All(b => b.IsValid);
Expand Down
5 changes: 5 additions & 0 deletions src/Nest/Search/MultiSearch/MultiSearchResponseFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public MultiSearchResponse Deserialize(ref JsonReader reader, IJsonFormatterReso
responses.Add(reader.ReadNextBlockSegment());
break;
}
else if (propertyName == "took")
{
response.Took = reader.ReadInt64();
continue;
}

reader.ReadNextBlock();
}
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Tests/Search/MultiSearch/MultiSearchApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ protected override LazyResponses ClientUsage() => Calls(

[I] public Task AssertResponse() => AssertOnAllResponses(r =>
{
r.Took.Should().BeGreaterThan(0);

r.TotalResponses.Should().Be(6);

var nvalidResponses = r.GetInvalidResponses();
Expand Down