From b2f645c0ede50cf78854e51b801665607e05a459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 14 Jul 2014 20:57:15 +0200 Subject: [PATCH 1/4] Updated doc to reflect defaults in code --- new_docs/contents/elasticsearch-net/cluster-failover.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/new_docs/contents/elasticsearch-net/cluster-failover.md b/new_docs/contents/elasticsearch-net/cluster-failover.md index 07f9657df8f..4ffc6ad58a8 100644 --- a/new_docs/contents/elasticsearch-net/cluster-failover.md +++ b/new_docs/contents/elasticsearch-net/cluster-failover.md @@ -23,10 +23,10 @@ Configuring how the registered `IConnectionPool` should behave happens on the `I #### SniffOnConnectionFault() Should the connection pool resniff the cluster state everytime an operation on a node throws an exception or a faulty http status code. -Defaults to false. +Defaults to true. #### SniffOnStartup() -Should the connection pool sniff the cluster state the first time its instantiated. Defaults to false. +Should the connection pool sniff the cluster state the first time its instantiated. Defaults to true. #### SniffLifeSpan() When set will cause the connectionpool to resniff whenever it notices the last sniff information happened too long ago. Defaults to null. From 94916749bfd8a39c5b3c1dc6d48b6eb4f514e692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 14 Jul 2014 21:44:23 +0200 Subject: [PATCH 2/4] Updated doc on Alias --- .../contents/nest/indices/aliases.markdown | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/new_docs/contents/nest/indices/aliases.markdown b/new_docs/contents/nest/indices/aliases.markdown index a13677b19ad..93a459f181a 100644 --- a/new_docs/contents/nest/indices/aliases.markdown +++ b/new_docs/contents/nest/indices/aliases.markdown @@ -8,16 +8,37 @@ menuitem: aliases #Aliasing +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) + ## Adding - var response = this.ConnectedClient.Alias("nest_test_data", "nest_test_data2"); + _client.Alias(a => a + .Add(add => add + .Index("myindex") + .Alias("myalias"))); + +## Removing + + _client.Alias(a => a + .Remove(remove => remove + .Index("myindex") + .Alias("myalias"))); ## Renaming - var response = this.ConnectedClient.Rename("nest_test_data", "nest_test_data2", "nest_test_data3"); +To rename a alias, just do an Add and a Remove in the same operation. Elasticsearch will then atomically rename your alias + _client.Alias(a => a + .Add(add => add + .Index("myindex") + .Alias("newalias")) + .Remove(remove => remove + .Index("myindex") + .Alias("oldalias"))); -## Removing +## Asynchronous + +Doing alias operations Async is simple: - var response = this.ConnectedClient.RemoveAlias("nest_test_data", "nest_test_data3"); + _client.AliasAsync(...); From 0592a1e57e347972708805d0129fb193be64e32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 14 Jul 2014 21:58:18 +0200 Subject: [PATCH 3/4] Added basic doc for Cluster State --- new_docs/contents/nest/cluster/state.markdown | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/new_docs/contents/nest/cluster/state.markdown b/new_docs/contents/nest/cluster/state.markdown index 99f35da70a5..f2f8d6a6f03 100644 --- a/new_docs/contents/nest/cluster/state.markdown +++ b/new_docs/contents/nest/cluster/state.markdown @@ -8,5 +8,17 @@ menuitem: state # Cluster state -cluster state has not yet been mapped +## Get state +To get the basic cluster state, call: + + var state = _client.ClusterState(); + +This returns a IClusterStateResponse that contains information about the master node, all nodes in the cluster and such. + +## Get specific part of state + +If you only want a specific part, i.e. only information about nodes, you can do the following: + + var state = _client.ClusterState(c => c + .Metrics(ClusterStateMetric.Nodes)); From 7b16706b2a08f806648d8c3cd06aa5e0e5981421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98sthus?= Date: Mon, 14 Jul 2014 21:59:33 +0200 Subject: [PATCH 4/4] Indent fix to Nodes Stats --- new_docs/contents/nest/cluster/nodes-stats.markdown | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/new_docs/contents/nest/cluster/nodes-stats.markdown b/new_docs/contents/nest/cluster/nodes-stats.markdown index 64dec16452b..fe5596ec5e7 100644 --- a/new_docs/contents/nest/cluster/nodes-stats.markdown +++ b/new_docs/contents/nest/cluster/nodes-stats.markdown @@ -8,11 +8,10 @@ menuitem: nodes-stats # Nodes stats -var r = this._client.NodeInfo(NodesInfo.All); - - var node = r.Nodes.First(); + var r = this._client.NodeInfo(NodesInfo.All); + var node = r.Nodes.First(); You can than traverse the node info objects i.e: - node.Value.OS.Cpu.CacheSizeInBytes; + node.Value.OS.Cpu.CacheSizeInBytes;