Skip to content

Add error handling to GetIndicesPointingToAlias #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions src/Nest/ElasticClient-Aliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,22 @@ private string _createCommand(string command, AliasParams aliasParam)
return cmd;
}

/// <summary>
/// Get all the indices pointing to an alias
/// </summary>
public IEnumerable<string> GetIndicesPointingToAlias(string alias)
{
var path = this.PathResolver.CreateIndexPath(alias, "/_aliases");
var status = this.Connection.GetSync(path);
var r = this.Deserialize<Dictionary<string, object>>(status.Result);
return r == null ? Enumerable.Empty<string>() : r.Keys;
}
/// <summary>
/// Get all the indices pointing to an alias
/// </summary>
public IEnumerable<string> GetIndicesPointingToAlias(string alias)
{
var path = this.PathResolver.CreateIndexPath(alias, "/_aliases");
var status = this.Connection.GetSync(path);
if (!status.Success)
{
return Enumerable.Empty<string>();
}
var r = this.Deserialize<Dictionary<string, object>>(status.Result);
return r == null ? Enumerable.Empty<string>() : r.Keys;
}

/// <summary>
/// <summary>
/// Repoint an alias from a set of old indices to a set of new indices in one operation
/// </summary>
public IIndicesOperationResponse Swap(string alias, IEnumerable<string> oldIndices, IEnumerable<string> newIndices)
Expand Down