Skip to content

Commit fc9357f

Browse files
committed
only 3 failing integration tests remain
1 parent 48291cc commit fc9357f

32 files changed

+346
-388
lines changed

src/Nest/DSL/CreateIndexDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public CreateIndexDescriptor Settings(Action<FluentDictionary<string, object>> s
6262
settingsSelector(dict);
6363
foreach (var kv in dict)
6464
{
65-
this._IndexSettings.TryAdd(kv.Key, kv.Value);
65+
this._IndexSettings.Settings.Add(kv.Key, kv.Value);
6666
}
6767
return this;
6868
}

src/Nest/DSL/RegisterPercolatorDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ ElasticsearchPathInfo<IndexQueryString> IPathInfo<IndexQueryString>.ToPathInfo(I
5959

6060
var pathInfo = base.ToPathInfo<IndexQueryString>(settings, new IndexQueryString());
6161
pathInfo.HttpMethod = PathInfoHttpMethod.POST;
62-
pathInfo.Type = pathInfo.Index;
62+
pathInfo.Index = pathInfo.Index;
6363
pathInfo.Id = pathInfo.Name;
64-
pathInfo.Index = "_percolator";
64+
pathInfo.Type = ".percolator";
6565

6666
return pathInfo;
6767
}

src/Nest/DSL/UnregisterPercolatorDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ ElasticsearchPathInfo<DeleteQueryString> IPathInfo<DeleteQueryString>.ToPathInfo
2222
//the name is actually the id, we rectify that here
2323

2424
var pathInfo = base.ToPathInfo<DeleteQueryString>(settings, new DeleteQueryString());
25-
pathInfo.Type = pathInfo.Index;
25+
pathInfo.Index = pathInfo.Index;
2626
pathInfo.Id = pathInfo.Name;
27-
pathInfo.Index = "_percolator";
27+
pathInfo.Type = ".percolator";
2828
pathInfo.HttpMethod = PathInfoHttpMethod.DELETE;
2929

3030
return pathInfo;

src/Nest/Domain/ElasticsearchResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class ElasticsearchResponse :
1515
IEnumerable<string>,
1616
IDictionary<string, object>
1717
{
18-
private readonly IDictionary<string, dynamic> dictionary =
18+
protected readonly IDictionary<string, dynamic> dictionary =
1919
new Dictionary<string, dynamic>(StringComparer.InvariantCultureIgnoreCase);
2020

2121
/// <summary>

src/Nest/Domain/Responses/ClusterStateResponse.cs

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,43 @@
33

44
namespace Nest
55
{
6-
public interface IClusterStateResponse : IResponse
7-
{
8-
string ClusterName { get; }
9-
string MasterNode { get; }
10-
Dictionary<string, NodeState> Nodes { get; }
11-
MetadataState Metadata { get; }
12-
RoutingTableState RoutingTable { get; }
13-
RoutingNodesState RoutingNodes { get; }
14-
BlockState Blocks { get; }
15-
}
6+
public interface IClusterStateResponse : IResponse
7+
{
8+
string ClusterName { get; }
9+
string MasterNode { get; }
10+
Dictionary<string, NodeState> Nodes { get; }
11+
MetadataState Metadata { get; }
12+
RoutingTableState RoutingTable { get; }
13+
RoutingNodesState RoutingNodes { get; }
14+
BlockState Blocks { get; }
15+
}
1616

17-
[JsonObject]
18-
public class ClusterStateResponse : BaseResponse, IClusterStateResponse
19-
{
20-
public ClusterStateResponse()
21-
{
22-
this.IsValid = true;
23-
}
24-
[JsonProperty("cluster_name")]
25-
public string ClusterName { get; internal set; }
26-
[JsonProperty("master_node")]
27-
public string MasterNode { get; internal set; }
17+
[JsonObject]
18+
public class ClusterStateResponse : BaseResponse, IClusterStateResponse
19+
{
20+
public ClusterStateResponse()
21+
{
22+
this.IsValid = true;
23+
}
24+
[JsonProperty("cluster_name")]
25+
public string ClusterName { get; internal set; }
26+
[JsonProperty("master_node")]
27+
public string MasterNode { get; internal set; }
2828

29-
[JsonProperty("nodes")]
29+
[JsonProperty("nodes")]
3030
[JsonConverter(typeof(DictionaryKeysAreNotPropertyNamesJsonConverter))]
3131
public Dictionary<string, NodeState> Nodes { get; internal set; }
3232

33-
[JsonProperty("metadata")]
34-
public MetadataState Metadata { get; internal set; }
33+
[JsonProperty("metadata")]
34+
public MetadataState Metadata { get; internal set; }
3535

36-
[JsonProperty("routing_table")]
37-
public RoutingTableState RoutingTable { get; internal set; }
38-
39-
[JsonProperty("routing_nodes")]
40-
public RoutingNodesState RoutingNodes { get; internal set; }
36+
[JsonProperty("routing_table")]
37+
public RoutingTableState RoutingTable { get; internal set; }
4138

42-
[JsonProperty("blocks")]
43-
public BlockState Blocks { get; internal set; }
44-
}
39+
[JsonProperty("routing_nodes")]
40+
public RoutingNodesState RoutingNodes { get; internal set; }
41+
42+
[JsonProperty("blocks")]
43+
public BlockState Blocks { get; internal set; }
44+
}
4545
}

src/Nest/Domain/Responses/GetMappingResponse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ internal GetMappingResponse(ConnectionStatus status, GetRootObjectMappingWrappin
2626
this.IsValid = status.Success && dict != null && dict.Count > 0;
2727
if (!this.IsValid) return;
2828
var firstNode = dict.First();
29+
if (!firstNode.Value.HasAny())
30+
return;
2931
var mappingNode = firstNode.Value["mappings"];
3032
if (mappingNode == null)
3133
{
Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
using Nest.Resolvers.Converters;
2-
using Newtonsoft.Json;
3-
4-
namespace Nest
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Nest.Resolvers.Converters;
5+
using Newtonsoft.Json;
6+
7+
namespace Nest
58
{
6-
public interface IIndexSettingsResponse : IResponse
7-
{
8-
IndexSettings Settings { get; }
9-
}
9+
public interface IIndexSettingsResponse : IResponse
10+
{
11+
IndexSettings Settings { get; }
12+
}
1013

11-
[JsonObject]
14+
[JsonObject(MemberSerialization.OptIn)]
15+
[JsonConverter(typeof(IndexSettingsResponseConverter))]
1216
public class IndexSettingsResponse : BaseResponse, IIndexSettingsResponse
13-
{
14-
public IndexSettings Settings { get; internal set; }
15-
}
16-
}
17+
{
18+
[JsonIgnore]
19+
public IndexSettings Settings
20+
{
21+
get { return Nodes.HasAny() ? Nodes.First().Value : null; }
22+
}
23+
24+
[JsonIgnore]
25+
public Dictionary<string, IndexSettings> Nodes { get; set; }
26+
27+
}
28+
}

src/Nest/Domain/Responses/NodeInfoResponse.cs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,25 @@
66

77
namespace Nest
88
{
9-
public interface INodeInfoResponse : IResponse
10-
{
11-
bool OK { get; }
12-
string ClusterName { get; }
13-
Dictionary<string, NodeInfo> Nodes { get; }
14-
}
9+
public interface INodeInfoResponse : IResponse
10+
{
11+
string ClusterName { get; }
12+
Dictionary<string, NodeInfo> Nodes { get; }
13+
}
1514

16-
[JsonObject]
17-
public class NodeInfoResponse : BaseResponse, INodeInfoResponse
18-
{
19-
public NodeInfoResponse()
20-
{
21-
this.IsValid = true;
22-
}
23-
[JsonProperty("ok")]
24-
public bool OK { get; internal set; }
15+
[JsonObject]
16+
public class NodeInfoResponse : BaseResponse, INodeInfoResponse
17+
{
18+
public NodeInfoResponse()
19+
{
20+
this.IsValid = true;
21+
}
2522

26-
[JsonProperty(PropertyName = "cluster_name")]
27-
public string ClusterName { get; internal set; }
23+
[JsonProperty(PropertyName = "cluster_name")]
24+
public string ClusterName { get; internal set; }
2825

29-
[JsonProperty(PropertyName = "nodes")]
26+
[JsonProperty(PropertyName = "nodes")]
3027
[JsonConverter(typeof(DictionaryKeysAreNotPropertyNamesJsonConverter))]
3128
public Dictionary<string, NodeInfo> Nodes { get; set; }
32-
}
29+
}
3330
}
Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
using System.Collections.Generic;
2+
using System.Security.Cryptography.X509Certificates;
23
using Newtonsoft.Json;
34

4-
namespace Nest
5+
namespace Nest
56
{
6-
public interface IPercolateResponse : IResponse
7-
{
8-
bool OK { get; }
9-
IEnumerable<string> Matches { get; }
10-
}
7+
public interface IPercolateResponse : IResponse
8+
{
9+
int Took { get; }
10+
long Total { get; }
11+
IEnumerable<PercolatorMatch> Matches { get; }
12+
}
1113

12-
[JsonObject]
14+
[JsonObject]
1315
public class PercolateResponse : BaseResponse, IPercolateResponse
14-
{
15-
public PercolateResponse()
16-
{
17-
this.IsValid = true;
18-
}
19-
20-
[JsonProperty(PropertyName = "ok")]
21-
public bool OK { get; internal set; }
22-
[JsonProperty(PropertyName = "matches")]
23-
public IEnumerable<string> Matches { get; internal set; }
24-
}
16+
{
17+
public PercolateResponse()
18+
{
19+
this.IsValid = true;
20+
}
21+
22+
[JsonProperty(PropertyName = "took")]
23+
public int Took { get; internal set; }
24+
[JsonProperty(PropertyName = "total")]
25+
public long Total { get; internal set; }
26+
[JsonProperty(PropertyName = "matches")]
27+
public IEnumerable<PercolatorMatch> Matches { get; internal set; }
28+
}
29+
30+
public class PercolatorMatch
31+
{
32+
[JsonProperty(PropertyName = "_index")]
33+
public string Index { get; set; }
34+
[JsonProperty(PropertyName = "_id")]
35+
public string Id { get; set; }
36+
}
2537
}
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
using Newtonsoft.Json;
22

3-
namespace Nest
3+
namespace Nest
44
{
5-
public interface IRegisterPercolateResponse : IResponse
6-
{
7-
bool OK { get; }
8-
string Index { get; }
9-
string Type { get; }
10-
string Id { get; }
11-
int Version { get; }
12-
}
5+
public interface IRegisterPercolateResponse : IResponse
6+
{
7+
bool Created { get; }
8+
string Index { get; }
9+
string Type { get; }
10+
string Id { get; }
11+
int Version { get; }
12+
}
1313

14-
[JsonObject]
14+
[JsonObject]
1515
public class RegisterPercolateResponse : BaseResponse, IRegisterPercolateResponse
16-
{
17-
public RegisterPercolateResponse()
18-
{
19-
this.IsValid = true;
20-
}
21-
[JsonProperty(PropertyName = "ok")]
22-
public bool OK { get; internal set; }
23-
24-
[JsonProperty(PropertyName = "_index")]
25-
public string Index { get; internal set; }
26-
27-
[JsonProperty(PropertyName = "_type")]
28-
public string Type { get; internal set; }
29-
30-
[JsonProperty(PropertyName = "_id")]
31-
public string Id { get; internal set; }
32-
33-
[JsonProperty(PropertyName = "_version")]
34-
public int Version { get; internal set; }
35-
}
16+
{
17+
public RegisterPercolateResponse()
18+
{
19+
this.IsValid = true;
20+
}
21+
[JsonProperty(PropertyName = "created")]
22+
public bool Created { get; internal set; }
23+
24+
[JsonProperty(PropertyName = "_index")]
25+
public string Index { get; internal set; }
26+
27+
[JsonProperty(PropertyName = "_type")]
28+
public string Type { get; internal set; }
29+
30+
[JsonProperty(PropertyName = "_id")]
31+
public string Id { get; internal set; }
32+
33+
[JsonProperty(PropertyName = "_version")]
34+
public int Version { get; internal set; }
35+
}
3636
}

0 commit comments

Comments
 (0)