Skip to content

Commit aa6185e

Browse files
committed
Merge branch 'master' of github.com:Mpdreamz/NEST
2 parents 6bbab2f + af72fb1 commit aa6185e

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

Diff for: src/Nest/ElasticClient-Aliases.cs

+15-11
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,22 @@ private string _createCommand(string command, AliasParams aliasParam)
3030
return cmd;
3131
}
3232

33-
/// <summary>
34-
/// Get all the indices pointing to an alias
35-
/// </summary>
36-
public IEnumerable<string> GetIndicesPointingToAlias(string alias)
37-
{
38-
var path = this.PathResolver.CreateIndexPath(alias, "/_aliases");
39-
var status = this.Connection.GetSync(path);
40-
var r = this.Deserialize<Dictionary<string, object>>(status.Result);
41-
return r == null ? Enumerable.Empty<string>() : r.Keys;
42-
}
33+
/// <summary>
34+
/// Get all the indices pointing to an alias
35+
/// </summary>
36+
public IEnumerable<string> GetIndicesPointingToAlias(string alias)
37+
{
38+
var path = this.PathResolver.CreateIndexPath(alias, "/_aliases");
39+
var status = this.Connection.GetSync(path);
40+
if (!status.Success)
41+
{
42+
return Enumerable.Empty<string>();
43+
}
44+
var r = this.Deserialize<Dictionary<string, object>>(status.Result);
45+
return r == null ? Enumerable.Empty<string>() : r.Keys;
46+
}
4347

44-
/// <summary>
48+
/// <summary>
4549
/// Repoint an alias from a set of old indices to a set of new indices in one operation
4650
/// </summary>
4751
public IIndicesOperationResponse Swap(string alias, IEnumerable<string> oldIndices, IEnumerable<string> newIndices)

Diff for: src/Nest/ElasticClient-MultiGet.cs

+18
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ public IEnumerable<T> MultiGet<T>(IEnumerable<string> ids)
3131
return this.MultiGet<T>(ids, this.PathResolver.CreateIndexTypePath(index, typeName));
3232
}
3333
/// <summary>
34+
/// Gets multiple documents of T by id in the specified index
35+
/// </summary>
36+
public IEnumerable<T> MultiGet<T>(string index, IEnumerable<int> ids)
37+
where T : class
38+
{
39+
return this.MultiGet<T>(index, ids.Select(i => Convert.ToString(i)));
40+
}
41+
/// <summary>
42+
/// Gets multiple documents of T by id in the specified index
43+
/// </summary>
44+
public IEnumerable<T> MultiGet<T>(string index, IEnumerable<string> ids)
45+
where T : class
46+
{
47+
var typeName = this.GetTypeNameFor<T>();
48+
49+
return this.MultiGet<T>(ids, this.PathResolver.CreateIndexTypePath(index, typeName));
50+
}
51+
/// <summary>
3452
/// Gets multiple documents of T by id in the specified index and the specified typename for T
3553
/// </summary>
3654
public IEnumerable<T> MultiGet<T>(string index, string type, IEnumerable<int> ids)

Diff for: src/Nest/Extensions/UriExtensions.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ public static class UriExtensions
66
{
77
public static string ToUrlAndOverridePath(this Uri uri, string path)
88
{
9-
return string.Format("http://{0}:{1}{2}", uri.Host, uri.Port, path);
9+
return uri.Scheme == Uri.UriSchemeHttps ?
10+
string.Format("https://{0}{1}", uri.Host, path) :
11+
string.Format("http://{0}:{1}{2}", uri.Host, uri.Port, path);
1012
}
1113
}
1214
}

0 commit comments

Comments
 (0)