Skip to content

Commit 52072aa

Browse files
committed
fixed Alias() generating wrong json
1 parent 2a3e27e commit 52072aa

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/Nest/ElasticClient-Aliases.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +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-
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-
}
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+
}
4747

48-
/// <summary>
48+
/// <summary>
4949
/// Repoint an alias from a set of old indices to a set of new indices in one operation
5050
/// </summary>
5151
public IIndicesOperationResponse Swap(string alias, IEnumerable<string> oldIndices, IEnumerable<string> newIndices)
@@ -96,8 +96,8 @@ public IIndicesOperationResponse Alias(string index, string alias)
9696
/// </summary>
9797
public IIndicesOperationResponse Alias(string index, IEnumerable<string> aliases)
9898
{
99-
aliases.Select(a => _createCommand("add", new AliasParams { Index = index, Alias = a }));
100-
var q = string.Join(",", aliases);
99+
var cmds = aliases.Select(a => _createCommand("add", new AliasParams { Index = index, Alias = a }));
100+
var q = string.Join(",", cmds);
101101
return this._Alias(q);
102102
}
103103
/// <summary>
@@ -106,8 +106,8 @@ public IIndicesOperationResponse Alias(string index, IEnumerable<string> aliases
106106
public IIndicesOperationResponse Alias(IEnumerable<string> aliases)
107107
{
108108
var index = this._connectionSettings.DefaultIndex;
109-
aliases.Select(a => _createCommand("add", new AliasParams { Index = index, Alias = a }));
110-
var q = string.Join(",", aliases);
109+
var cmds = aliases.Select(a => _createCommand("add", new AliasParams { Index = index, Alias = a }));
110+
var q = string.Join(",", cmds);
111111
return this._Alias(q);
112112
}
113113
/// <summary>
@@ -133,26 +133,26 @@ public IIndicesOperationResponse RemoveAlias(string index, string alias)
133133
public IIndicesOperationResponse RemoveAlias(IEnumerable<string> aliases)
134134
{
135135
var index = this._connectionSettings.DefaultIndex;
136-
aliases.Select(a => _createCommand("remove", new AliasParams { Index = index, Alias = a }));
137-
var q = string.Join(",", aliases);
136+
var cmds = aliases.Select(a => _createCommand("remove", new AliasParams { Index = index, Alias = a }));
137+
var q = string.Join(",", cmds);
138138
return this._Alias(q);
139139
}
140140
/// <summary>
141141
/// Remove multiple alias for the specified index
142142
/// </summary>
143143
public IIndicesOperationResponse RemoveAlias(string index, IEnumerable<string> aliases)
144144
{
145-
aliases.Select(a => _createCommand("remove", new AliasParams { Index = index, Alias = a }));
146-
var q = string.Join(",", aliases);
145+
var cmds = aliases.Select(a => _createCommand("remove", new AliasParams { Index = index, Alias = a }));
146+
var q = string.Join(",", cmds);
147147
return this._Alias(q);
148148
}
149149
/// <summary>
150150
/// Associate multiple indices with one alias
151151
/// </summary>
152152
public IIndicesOperationResponse Alias(IEnumerable<string> indices, string alias)
153153
{
154-
indices.Select(i => _createCommand("add", new AliasParams { Index = i, Alias = alias }));
155-
var q = string.Join(",", indices);
154+
var cmds = indices.Select(i => _createCommand("add", new AliasParams { Index = i, Alias = alias }));
155+
var q = string.Join(",", cmds);
156156
return this._Alias(q);
157157
}
158158
/// <summary>
@@ -177,7 +177,7 @@ public IIndicesOperationResponse Alias(AliasParams aliasParams)
177177
public IIndicesOperationResponse Alias(IEnumerable<AliasParams> aliases)
178178
{
179179
var cmds = aliases.Select(a => _aliasBody.F(_createCommand("add", a)));
180-
var q = string.Join(",", aliases);
180+
var q = string.Join(",", cmds);
181181
return this._Alias(q);
182182
}
183183
/// <summary>
@@ -193,7 +193,7 @@ public IIndicesOperationResponse RemoveAlias(AliasParams aliasParams)
193193
public IIndicesOperationResponse RemoveAliases(IEnumerable<AliasParams> aliases)
194194
{
195195
var cmds = aliases.Select(a => _aliasBody.F(_createCommand("remove", a)));
196-
var q = string.Join(",", aliases);
196+
var q = string.Join(",", cmds);
197197
return this._Alias(q);
198198
}
199199
private IndicesOperationResponse _Alias(string query)

0 commit comments

Comments
 (0)