You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: new_docs/contents/nest/indices/aliases.markdown
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,37 @@ menuitem: aliases
8
8
9
9
#Aliasing
10
10
11
+
Adding/removing and updating aliases are also easy to do in NEST. For more information look at the [Alias Doc](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html)
12
+
11
13
## Adding
12
14
13
-
var response = this.ConnectedClient.Alias("nest_test_data", "nest_test_data2");
15
+
_client.Alias(a => a
16
+
.Add(add => add
17
+
.Index("myindex")
18
+
.Alias("myalias")));
19
+
20
+
## Removing
21
+
22
+
_client.Alias(a => a
23
+
.Remove(remove => remove
24
+
.Index("myindex")
25
+
.Alias("myalias")));
14
26
15
27
16
28
## Renaming
17
29
18
-
var response = this.ConnectedClient.Rename("nest_test_data", "nest_test_data2", "nest_test_data3");
30
+
To rename a alias, just do an Add and a Remove in the same operation. Elasticsearch will then atomically rename your alias
19
31
32
+
_client.Alias(a => a
33
+
.Add(add => add
34
+
.Index("myindex")
35
+
.Alias("newalias"))
36
+
.Remove(remove => remove
37
+
.Index("myindex")
38
+
.Alias("oldalias")));
20
39
21
-
## Removing
40
+
## Asynchronous
41
+
42
+
Doing alias operations Async is simple:
22
43
23
-
var response = this.ConnectedClient.RemoveAlias("nest_test_data", "nest_test_data3");
0 commit comments