Skip to content

Commit 89513a6

Browse files
committed
Merge branch 'develop' into feature/cat-apis
Conflicts: src/Nest/Nest.csproj
2 parents be5fcaf + 7b836e3 commit 89513a6

File tree

204 files changed

+3175
-437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+3175
-437
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace CodeGeneration.LowLevelClient
1818
{
1919
public static class ApiGenerator
2020
{
21-
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.0/rest-api-spec/api";
22-
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.0/rest-api-spec/api/";
21+
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/api";
22+
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/api/";
2323
private readonly static string _nestFolder = @"..\..\..\..\..\src\Nest\";
2424
private readonly static string _esNetFolder = @"..\..\..\..\..\src\Elasticsearch.Net\";
2525
private readonly static string _viewFolder = @"..\..\Views\";

src/CodeGeneration/CodeGeneration.YamlTestsRunner/Domain/TestSuite.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ private static string PropertyPath(string value)
134134
return "this._status";
135135

136136
value = Regex.Replace(value, @"\.(\d+)\.?", "[$1].");
137+
//make sure we escape reserverd keywords
138+
value = Regex.Replace(value, @"(^|\.)(class|params|default)(\.|$)", "$1@$2$3");
137139
if (value.Length > 0)
138140
value = "." + value;
139141
if (Regex.IsMatch(value, @"([\s\-]|\\\.)"))

src/CodeGeneration/CodeGeneration.YamlTestsRunner/Extensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static string SerializeToAnonymousObject(this object o, string indentatio
124124
return "\t\t\t\t" + m.Value.Replace(" ", "\t");
125125
}, RegexOptions.Multiline);
126126
//escape c# keywords in the anon object
127-
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=");
127+
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=").Replace("class=", "@class=");
128128
//docs contain different types of anon objects, quick fix by making them a dynamic[]
129129
anon = anon.Replace("docs= new []", "docs= new dynamic[]");
130130
//fix empty untyped arrays, default to string
@@ -145,6 +145,8 @@ public static string EscapeQuotes(this string s)
145145

146146
public static string SurroundWithQuotes(this string s)
147147
{
148+
if (Regex.IsMatch(s, @"^\d+(?:\.\d+)?$"))
149+
return s;
148150
return "@\"" + s.EscapeQuotes() + "\"";
149151
}
150152
}

src/CodeGeneration/CodeGeneration.YamlTestsRunner/YamlTestsGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace CodeGeneration.YamlTestsRunner
2525
using YamlTestSuite = Dictionary<string, object>;
2626
public static class YamlTestsGenerator
2727
{
28-
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.1/rest-api-spec/test";
29-
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.1/rest-api-spec/test/";
28+
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/test";
29+
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/test/";
3030
private readonly static string _testProjectFolder = @"..\..\..\..\..\src\Tests\Elasticsearch.Net.Integration.Yaml\";
3131
private readonly static string _rawClientInterface = @"..\..\..\..\..\src\Elasticsearch.Net\IElasticsearchClient.generated.cs";
3232
private readonly static string _viewFolder = @"..\..\Views\";
@@ -96,7 +96,8 @@ public static YamlSpecification GetYamlTestSpecification(bool useCache = false)
9696
"index/60_refresh.yaml",
9797
"create/60_refresh.yaml",
9898
"update/60_refresh.yaml",
99-
"search_shards/10_basic.yaml"
99+
"search_shards/10_basic.yaml",
100+
"template/10_basic.yaml"
100101
};
101102

102103
private static IList<YamlDefinition> GetFolderFiles(string folder, bool useCache = false)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Elasticsearch.Net;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
internal static class ClusterPendingTasksPathInfo
10+
{
11+
public static void Update(ElasticsearchPathInfo<ClusterPendingTasksRequestParameters> pathInfo)
12+
{
13+
pathInfo.HttpMethod = PathInfoHttpMethod.GET;
14+
}
15+
}
16+
17+
public interface IClusterPendingTasksRequest : IRequest<ClusterPendingTasksRequestParameters>
18+
{
19+
}
20+
21+
public partial class ClusterPendingTasksRequest
22+
: BasePathRequest<ClusterPendingTasksRequestParameters>, IClusterPendingTasksRequest
23+
{
24+
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterPendingTasksRequestParameters> pathInfo)
25+
{
26+
ClusterPendingTasksPathInfo.Update(pathInfo);
27+
}
28+
}
29+
30+
public partial class ClusterPendingTasksDescriptor
31+
: BasePathDescriptor<ClusterPendingTasksDescriptor, ClusterPendingTasksRequestParameters>, IClusterPendingTasksRequest
32+
{
33+
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterPendingTasksRequestParameters> pathInfo)
34+
{
35+
ClusterPendingTasksPathInfo.Update(pathInfo);
36+
}
37+
}
38+
}

src/Nest/DSL/_Descriptors.generated.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ public ClusterHealthDescriptor WaitForStatus(WaitForStatus wait_for_status)
10071007
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/cluster-pending.html
10081008
///</pre>
10091009
///</summary>
1010-
public partial class ClusterPendingTasksDescriptor : BaseRequest<ClusterPendingTasksRequestParameters>
1010+
public partial class ClusterPendingTasksDescriptor
10111011
{
10121012

10131013

@@ -1027,12 +1027,6 @@ public ClusterPendingTasksDescriptor MasterTimeout(string master_timeout)
10271027
return this;
10281028
}
10291029

1030-
1031-
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterPendingTasksRequestParameters> pathInfo)
1032-
{
1033-
throw new NotImplementedException();
1034-
}
1035-
10361030

10371031
}
10381032

src/Nest/DSL/_Requests.generated.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ public WaitForStatus WaitForStatus
941941
///http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/cluster-pending.html
942942
///</pre>
943943
///</summary>
944-
public partial class ClusterPendingTasksRequest : BasePathRequest<ClusterPendingTasksRequestParameters>
944+
public partial class ClusterPendingTasksRequest
945945
{
946946

947947
///<summary>Return local information, do not retrieve the state from master node (default: false)</summary>
@@ -959,12 +959,6 @@ public string MasterTimeout
959959
set { this.Request.RequestParameters.AddQueryString("master_timeout", value); }
960960
}
961961

962-
963-
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<ClusterPendingTasksRequestParameters> pathInfo)
964-
{
965-
throw new NotImplementedException();
966-
}
967-
968962
}
969963

970964

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace Nest
8+
{
9+
public interface IClusterPendingTasksResponse : IResponse
10+
{
11+
IEnumerable<PendingTask> Tasks { get; set; }
12+
}
13+
14+
[JsonObject]
15+
public class ClusterPendingTasksResponse : BaseResponse, IClusterPendingTasksResponse
16+
{
17+
[JsonProperty("tasks")]
18+
public IEnumerable<PendingTask> Tasks { get; set; }
19+
}
20+
21+
[JsonObject]
22+
public class PendingTask
23+
{
24+
[JsonProperty("insert_order")]
25+
public int InsertOrder { get; set; }
26+
27+
[JsonProperty("priority")]
28+
public string Priority { get; set; }
29+
30+
[JsonProperty("source")]
31+
public string Source { get; set; }
32+
33+
[JsonProperty("time_in_queue_millis")]
34+
public int TimeInQueueMilliseconds { get; set; }
35+
36+
[JsonProperty("time_in_queue")]
37+
public string TimeInQueue { get; set; }
38+
}
39+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using Elasticsearch.Net;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Nest
9+
{
10+
public partial class ElasticClient
11+
{
12+
/// <inheritdoc />
13+
public IClusterPendingTasksResponse ClusterPendingTasks(Func<ClusterPendingTasksDescriptor, ClusterPendingTasksDescriptor> pendingTasksSelector = null)
14+
{
15+
pendingTasksSelector = pendingTasksSelector ?? (s => s);
16+
return this.Dispatch<ClusterPendingTasksDescriptor, ClusterPendingTasksRequestParameters, ClusterPendingTasksResponse>(
17+
pendingTasksSelector,
18+
(p, d) => this.RawDispatch.ClusterPendingTasksDispatch<ClusterPendingTasksResponse>(p)
19+
);
20+
}
21+
22+
/// <inheritdoc />
23+
public Task<IClusterPendingTasksResponse> ClusterPendingTasksAsync(Func<ClusterPendingTasksDescriptor, ClusterPendingTasksDescriptor> pendingTasksSelector = null)
24+
{
25+
pendingTasksSelector = pendingTasksSelector ?? (s => s);
26+
return this.DispatchAsync<ClusterPendingTasksDescriptor, ClusterPendingTasksRequestParameters, ClusterPendingTasksResponse, IClusterPendingTasksResponse>(
27+
pendingTasksSelector,
28+
(p, d) => this.RawDispatch.ClusterPendingTasksDispatchAsync<ClusterPendingTasksResponse>(p)
29+
);
30+
}
31+
32+
/// <inheritdoc />
33+
public IClusterPendingTasksResponse ClusterPendingTasks(IClusterPendingTasksRequest pendingTasksRequest)
34+
{
35+
return this.Dispatch<IClusterPendingTasksRequest, ClusterPendingTasksRequestParameters, ClusterPendingTasksResponse>(
36+
pendingTasksRequest,
37+
(p, d) => this.RawDispatch.ClusterPendingTasksDispatch<ClusterPendingTasksResponse>(p)
38+
);
39+
}
40+
41+
/// <inheritdoc />
42+
public Task<IClusterPendingTasksResponse> ClusterPendingTasksAsync(IClusterPendingTasksRequest pendingTasksRequest)
43+
{
44+
return this.DispatchAsync<IClusterPendingTasksRequest, ClusterPendingTasksRequestParameters, ClusterPendingTasksResponse, IClusterPendingTasksResponse>(
45+
pendingTasksRequest,
46+
(p, d) => this.RawDispatch.ClusterPendingTasksDispatchAsync<ClusterPendingTasksResponse>(p)
47+
);
48+
}
49+
}
50+
}

src/Nest/Enums/IndexOptions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public enum IndexOptions
1212
[EnumMember(Value = "freqs")]
1313
Freqs,
1414
[EnumMember(Value = "positions")]
15-
Positions
15+
Positions,
16+
[EnumMember(Value = "offsets")]
17+
Offsets,
1618
}
1719
}

0 commit comments

Comments
 (0)