Skip to content

Commit 62feee0

Browse files
committed
Merge pull request #293 from MaxHorstmann/master
Add error handling to GetIndicesPointingToAlias
2 parents 45cbfb1 + 7d5e3b4 commit 62feee0

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/Nest/ElasticClient-Aliases.cs

Lines changed: 15 additions & 11 deletions
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)

0 commit comments

Comments
 (0)