Skip to content

Commit 5e23197

Browse files
committed
fixed segment responses
1 parent eb692a1 commit 5e23197

File tree

6 files changed

+21
-45
lines changed

6 files changed

+21
-45
lines changed

src/Nest/Domain/Responses/SegmentsResponse.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@ namespace Nest
55
{
66
public interface ISegmentsResponse : IResponse
77
{
8-
bool OK { get; }
98
ShardsMetaData Shards { get; }
109
Dictionary<string, IndexSegment> Indices { get; set; }
1110
}
1211

1312
[JsonObject]
1413
public class SegmentsResponse : BaseResponse, ISegmentsResponse
1514
{
16-
public SegmentsResponse()
17-
{
18-
this.IsValid = true;
19-
}
20-
21-
[JsonProperty(PropertyName = "ok")]
22-
public bool OK { get; internal set; }
2315

2416
[JsonProperty(PropertyName = "_shards")]
2517
public ShardsMetaData Shards { get; internal set; }

src/Tests/Nest.Tests.Integration/Indices/FlushTests.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ public void FlushAll()
1212
{
1313
var r = this._client.Flush(f=>f.AllIndices());
1414
r.Shards.Should().NotBeNull();
15-
r.Shards.Total.Should().BeGreaterThan(0);
16-
r.Shards.Total.Should().Be(r.Shards.Successful);
15+
r.Shards.Successful.Should().BeGreaterThan(0);
1716
}
1817
[Test]
1918
public void FlushIndex()
2019
{
2120
var r = this._client.Flush(f=>f.Index(ElasticsearchConfiguration.DefaultIndex));
2221
r.Shards.Should().NotBeNull();
23-
r.Shards.Total.Should().BeGreaterThan(0);
24-
r.Shards.Total.Should().Be(r.Shards.Successful);
22+
r.Shards.Successful.Should().BeGreaterThan(0);
2523
}
2624
[Test]
2725
public void FlushIndeces()
@@ -30,16 +28,14 @@ public void FlushIndeces()
3028
.Indices( ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex + "_clone")
3129
);
3230
r.Shards.Should().NotBeNull();
33-
r.Shards.Total.Should().BeGreaterThan(0);
34-
r.Shards.Total.Should().Be(r.Shards.Successful);
31+
r.Shards.Successful.Should().BeGreaterThan(0);
3532
}
3633
[Test]
3734
public void FlushTyped()
3835
{
3936
var r = this._client.Flush(f=>f.Index<ElasticsearchProject>());
4037
r.Shards.Should().NotBeNull();
41-
r.Shards.Total.Should().BeGreaterThan(0);
42-
r.Shards.Total.Should().Be(r.Shards.Successful);
38+
r.Shards.Successful.Should().BeGreaterThan(0);
4339
}
4440

4541
}

src/Tests/Nest.Tests.Integration/Indices/OptimizeTests.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,34 @@ public void OptimizeAll()
1212
{
1313
var r = this._client.Optimize();
1414
r.Shards.Should().NotBeNull();
15-
r.Shards.Total.Should().BeGreaterThan(0);
16-
r.Shards.Total.Should().Be(r.Shards.Successful);
15+
r.Shards.Successful.Should().BeGreaterThan(0);
1716
}
1817
[Test]
1918
public void OptimizeIndex()
2019
{
2120
var r = this._client.Optimize(o=>o.Index(ElasticsearchConfiguration.DefaultIndex));
2221
r.Shards.Should().NotBeNull();
23-
r.Shards.Total.Should().BeGreaterThan(0);
24-
r.Shards.Total.Should().Be(r.Shards.Successful);
22+
r.Shards.Successful.Should().BeGreaterThan(0);
2523
}
2624
[Test]
2725
public void OptimizeIndices()
2826
{
2927
var r = this._client.Optimize(o=>o.Indices(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex + "_clone" ));
3028
r.Shards.Should().NotBeNull();
31-
r.Shards.Total.Should().BeGreaterThan(0);
32-
r.Shards.Total.Should().Be(r.Shards.Successful);
29+
r.Shards.Successful.Should().BeGreaterThan(0);
3330
}
3431
[Test]
3532
public void OptimizeTyped()
3633
{
3734
var r = this._client.Optimize(o=>o.Index<ElasticsearchProject>());
3835
r.Shards.Should().NotBeNull();
39-
r.Shards.Total.Should().BeGreaterThan(0);
40-
r.Shards.Total.Should().Be(r.Shards.Successful);
36+
r.Shards.Successful.Should().BeGreaterThan(0);
4137
}
4238
public void OptimizeAllWithParameters()
4339
{
4440
var r = this._client.Optimize(o=>o.MaxNumSegments(2));
4541
r.Shards.Should().NotBeNull();
46-
r.Shards.Total.Should().BeGreaterThan(0);
47-
r.Shards.Total.Should().Be(r.Shards.Successful);
42+
r.Shards.Successful.Should().BeGreaterThan(0);
4843
}
4944

5045
}

src/Tests/Nest.Tests.Integration/Indices/RefreshTests.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ public void RefreshAll()
1212
{
1313
var r = this._client.Refresh();
1414
r.Shards.Should().NotBeNull();
15-
r.Shards.Total.Should().BeGreaterThan(0);
16-
r.Shards.Total.Should().Be(r.Shards.Successful);
15+
r.Shards.Successful.Should().BeGreaterThan(0);
1716
}
1817
[Test]
1918
public void RefreshIndex()
2019
{
2120
var r = this._client.Refresh(e=>e.Index(ElasticsearchConfiguration.DefaultIndex));
2221
r.Shards.Should().NotBeNull();
23-
r.Shards.Total.Should().BeGreaterThan(0);
24-
r.Shards.Total.Should().Be(r.Shards.Successful);
22+
r.Shards.Successful.Should().BeGreaterThan(0);
2523
}
2624
[Test]
2725
public void RefreshIndeces()
@@ -30,16 +28,14 @@ public void RefreshIndeces()
3028
.Indices(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex + "_clone" )
3129
);
3230
r.Shards.Should().NotBeNull();
33-
r.Shards.Total.Should().BeGreaterThan(0);
34-
r.Shards.Total.Should().Be(r.Shards.Successful);
31+
r.Shards.Successful.Should().BeGreaterThan(0);
3532
}
3633
[Test]
3734
public void RefreshTyped()
3835
{
3936
var r = this._client.Refresh(rr => rr.Index<ElasticsearchProject>());
4037
r.Shards.Should().NotBeNull();
41-
r.Shards.Total.Should().BeGreaterThan(0);
42-
r.Shards.Total.Should().Be(r.Shards.Successful);
38+
r.Shards.Successful.Should().BeGreaterThan(0);
4339
}
4440
}
4541
}

src/Tests/Nest.Tests.Integration/Indices/SegmentsTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Linq;
2+
using FluentAssertions;
23
using NUnit.Framework;
34

45
namespace Nest.Tests.Integration.Indices
@@ -11,7 +12,7 @@ public void AllSegments()
1112
{
1213
var r = this._client.Segments();
1314
Assert.True(r.IsValid);
14-
Assert.True(r.OK);
15+
r.Shards.Successful.Should().BeGreaterThan(0);
1516

1617
Assert.NotNull(r.Shards);
1718
Assert.NotNull(r.Indices);
@@ -33,7 +34,7 @@ public void SingleSegment()
3334
{
3435
var r = this._client.Segments(s=>s.Index(ElasticsearchConfiguration.DefaultIndex));
3536
Assert.True(r.IsValid);
36-
Assert.True(r.OK);
37+
r.Shards.Successful.Should().BeGreaterThan(0);
3738

3839
Assert.NotNull(r.Shards);
3940
Assert.NotNull(r.Indices);
@@ -56,7 +57,7 @@ public void MultipleSegment()
5657
var indices = new [] {ElasticsearchConfiguration.DefaultIndex , ElasticsearchConfiguration.DefaultIndex + "_clone"};
5758
var r = this._client.Segments(s=>s.Indices(indices));
5859
Assert.True(r.IsValid);
59-
Assert.True(r.OK);
60+
r.Shards.Successful.Should().BeGreaterThan(0);
6061

6162
Assert.NotNull(r.Shards);
6263
Assert.NotNull(r.Indices);

src/Tests/Nest.Tests.Integration/Indices/SnapshotTests.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ public void SnapshotAll()
1212
{
1313
var r = this._client.Snapshot();
1414
r.Shards.Should().NotBeNull();
15-
r.Shards.Total.Should().BeGreaterThan(0);
16-
r.Shards.Total.Should().Be(r.Shards.Successful);
15+
r.Shards.Successful.Should().BeGreaterThan(0);
1716
}
1817
[Test]
1918
public void SnapshotIndex()
2019
{
2120
var r = this._client.Snapshot(s=>s.Index(ElasticsearchConfiguration.DefaultIndex));
2221
r.Shards.Should().NotBeNull();
23-
r.Shards.Total.Should().BeGreaterThan(0);
24-
r.Shards.Total.Should().Be(r.Shards.Successful);
22+
r.Shards.Successful.Should().BeGreaterThan(0);
2523
}
2624
[Test]
2725
public void SnapshotIndices()
@@ -31,16 +29,14 @@ public void SnapshotIndices()
3129
ElasticsearchConfiguration.DefaultIndex + "_clone")
3230
);
3331
r.Shards.Should().NotBeNull();
34-
r.Shards.Total.Should().BeGreaterThan(0);
35-
r.Shards.Total.Should().Be(r.Shards.Successful);
32+
r.Shards.Successful.Should().BeGreaterThan(0);
3633
}
3734
[Test]
3835
public void SnapshotTyped()
3936
{
4037
var r = this._client.Snapshot(s=>s.Index<ElasticsearchProject>());
4138
r.Shards.Should().NotBeNull();
42-
r.Shards.Total.Should().BeGreaterThan(0);
43-
r.Shards.Total.Should().Be(r.Shards.Successful);
39+
r.Shards.Successful.Should().BeGreaterThan(0);
4440
}
4541
}
4642
}

0 commit comments

Comments
 (0)