Skip to content

Commit ed514ec

Browse files
committed
small touchups
1 parent af5e056 commit ed514ec

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

src/Elasticsearch.Net/Responses/ElasticsearchResponse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ public static string DebugInformationBuilder(IApiCallDetails r, StringBuilder sb
2222

2323
var response = r.ResponseBodyInBytes?.Utf8String() ?? ResponseStatics.ResponseAlreadyCaptured;
2424
var request = r.RequestBodyInBytes?.Utf8String() ?? ResponseStatics.RequestAlreadyCaptured;
25-
sb.AppendLine($"# Request :\r\n{request}");
26-
sb.AppendLine($"# Response :\r\n{response}");
25+
sb.AppendLine($"# Request:\r\n{request}");
26+
sb.AppendLine($"# Response:\r\n{response}");
2727

2828
return sb.ToString();
2929
}
3030

3131
public static void DebugAuditTrailExceptions(List<Audit> auditTrail, StringBuilder sb)
3232
{
33-
var auditExceptions = auditTrail.Where(a => a.Exception != null);
34-
foreach (var a in auditExceptions.Select((audit, i) => new {audit, i}))
33+
var auditExceptions = auditTrail.Select((audit, i) => new {audit, i}).Where(a => a.audit.Exception != null);
34+
foreach (var a in auditExceptions)
3535
sb.AppendLine($"# Audit exception in step {a.i} {a.audit.Event.GetStringValue()}:\r\n{a.audit.Exception}");
3636
}
3737

src/Nest/Document/Multiple/Bulk/BulkResponse.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ public class BulkResponse : ResponseBase, IBulkResponse
1919
public override bool IsValid => base.IsValid && !this.Errors && !this.ItemsWithErrors.HasAny();
2020
protected override void DebugIsValid(StringBuilder sb)
2121
{
22+
sb.AppendLine($"# Invalid Bulk items:");
2223
foreach(var i in Items.Select((item, i) => new { item, i}).Where(i=>!i.item.IsValid))
23-
sb.AppendLine($"operation[{i.i}]: {i.item}");
24+
sb.AppendLine($" operation[{i.i}]: {i.item}");
2425
}
2526

2627
[JsonProperty("took")]

src/Nest/Search/MultiSearch/MultiSearchResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using System.Text;
34
using Elasticsearch.Net;
45
using Newtonsoft.Json;
56

@@ -15,6 +16,13 @@ public MultiSearchResponse()
1516
}
1617

1718
public override bool IsValid => base.IsValid && this.AllResponses.All(b => b.IsValid);
19+
20+
protected override void DebugIsValid(StringBuilder sb)
21+
{
22+
sb.AppendLine($"# Invalid searches (inspect individual response.DebugInformation for more detail):");
23+
foreach(var i in AllResponses.Select((item, i) => new { item, i}).Where(i=>!i.item.IsValid))
24+
sb.AppendLine($" search[{i.i}]: {i.item}");
25+
}
1826

1927
[JsonConverter(typeof(VerbatimDictionaryKeysJsonConverter))]
2028
internal IDictionary<string, object> Responses { get; set; }

src/Nest/Search/Percolator/MultiPercolate/MultiPercolateResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using System.Text;
34
using Elasticsearch.Net;
45
using Newtonsoft.Json;
56

@@ -16,6 +17,13 @@ public class MultiPercolateResponse : ResponseBase, IMultiPercolateResponse
1617
{
1718
public override bool IsValid => base.IsValid && this.Responses.All(r => r.IsValid);
1819

20+
protected override void DebugIsValid(StringBuilder sb)
21+
{
22+
sb.AppendLine($"# Invalid percolations (inspect individual response.DebugInformation for more detail):");
23+
foreach(var i in AllResponses.Select((item, i) => new { item, i}).Where(i=>!i.item.IsValid))
24+
sb.AppendLine($" search[{i.i}]: {i.item}");
25+
}
26+
1927
[JsonProperty("responses")]
2028
internal IEnumerable<PercolateResponse> AllResponses { get; set; }
2129

src/Tests/tests.yaml

Lines changed: 1 addition & 1 deletion
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: i
2+
mode: u
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)