Skip to content

Commit 213eb1a

Browse files
committed
Merge branch 'develop' of github.com:elasticsearch/elasticsearch-net into develop
2 parents 9bde603 + 86020c2 commit 213eb1a

File tree

134 files changed

+835
-728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+835
-728
lines changed
19.5 KB
Binary file not shown.

dep/repositories.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<repositories>
33
<repository path="..\src\CodeGeneration\CodeGeneration.LowLevelClient\packages.config" />
44
<repository path="..\src\CodeGeneration\CodeGeneration.YamlTestsRunner\packages.config" />
5-
<repository path="..\src\Connections\Elasticsearch.Net.Connection.HttpClient\packages.config" />
65
<repository path="..\src\Connections\Elasticsearch.Net.Connection.Thrift\packages.config" />
76
<repository path="..\src\Elasticsearch.Net\packages.config" />
87
<repository path="..\src\Nest\packages.config" />

new_docs/contents/elasticsearch-net/cluster-failover.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ Configuring how the registered `IConnectionPool` should behave happens on the `I
2323

2424
#### SniffOnConnectionFault()
2525
Should the connection pool resniff the cluster state everytime an operation on a node throws an exception or a faulty http status code.
26-
Defaults to false.
26+
Defaults to true.
2727

2828
#### SniffOnStartup()
29-
Should the connection pool sniff the cluster state the first time its instantiated. Defaults to false.
29+
Should the connection pool sniff the cluster state the first time its instantiated. Defaults to true.
3030

3131
#### SniffLifeSpan()
3232
When set will cause the connectionpool to resniff whenever it notices the last sniff information happened too long ago. Defaults to null.

new_docs/contents/nest/cluster/nodes-stats.markdown

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ menuitem: nodes-stats
88

99
# Nodes stats
1010

11-
var r = this._client.NodeInfo(NodesInfo.All);
12-
13-
var node = r.Nodes.First();
11+
var r = this._client.NodeInfo(NodesInfo.All);
12+
var node = r.Nodes.First();
1413

1514
You can than traverse the node info objects i.e:
1615

17-
node.Value.OS.Cpu.CacheSizeInBytes;
16+
node.Value.OS.Cpu.CacheSizeInBytes;
1817

new_docs/contents/nest/cluster/state.markdown

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,17 @@ menuitem: state
88

99
# Cluster state
1010

11-
cluster state has not yet been mapped
11+
## Get state
1212

13+
To get the basic cluster state, call:
14+
15+
var state = _client.ClusterState();
16+
17+
This returns a IClusterStateResponse that contains information about the master node, all nodes in the cluster and such.
18+
19+
## Get specific part of state
20+
21+
If you only want a specific part, i.e. only information about nodes, you can do the following:
22+
23+
var state = _client.ClusterState(c => c
24+
.Metrics(ClusterStateMetric.Nodes));

new_docs/contents/nest/indices/aliases.markdown

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,37 @@ menuitem: aliases
88

99
#Aliasing
1010

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+
1113
## Adding
1214

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")));
1426

1527

1628
## Renaming
1729

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
1931

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")));
2039

21-
## Removing
40+
## Asynchronous
41+
42+
Doing alias operations Async is simple:
2243

23-
var response = this.ConnectedClient.RemoveAlias("nest_test_data", "nest_test_data3");
44+
_client.AliasAsync(...);

src/Nest/Domain/Connection/ConnectionSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ string IConnectionSettingsValues.DefaultIndex
5757
{
5858
get
5959
{
60-
if (this._defaultIndex.IsNullOrEmpty())
61-
throw new NullReferenceException("No default index set on connection!");
60+
//if (this._defaultIndex.IsNullOrEmpty())
61+
// throw new NullReferenceException("No default index set on connection!");
6262
return this._defaultIndex;
6363
}
6464
}

src/Nest/ElasticClient.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
3+
using System.IO;
4+
using System.Linq;
45
using System.Threading.Tasks;
56
using Elasticsearch.Net;
67
using Elasticsearch.Net.Connection;
@@ -100,14 +101,6 @@ D descriptor
100101
return badResponse;
101102
}
102103

103-
104-
private static R CreateValidInstance<R>(IElasticsearchResponse response) where R : BaseResponse
105-
{
106-
var r = (R)typeof(R).CreateInstance();
107-
((IResponseWithRequestInformation)r).RequestInformation = response;
108-
r.IsValid = true;
109-
return r;
110-
}
111104
private static R CreateInvalidInstance<R>(IElasticsearchResponse response) where R : BaseResponse
112105
{
113106
var r = (R)typeof(R).CreateInstance();
@@ -145,5 +138,16 @@ D descriptor
145138
}
146139

147140

141+
public static void Warmup()
142+
{
143+
var client = new ElasticClient(connection: new InMemoryConnection());
144+
var stream = new MemoryStream("{}".Utf8Bytes());
145+
client.Serializer.Serialize(new SearchDescriptor<object>());
146+
client.Serializer.Deserialize<SearchDescriptor<object>>(stream);
147+
var connection = new HttpConnection(new ConnectionSettings());
148+
client.RootNodeInfo();
149+
client.Search<object>(s=>s.MatchAll().Index("someindex"));
150+
}
151+
148152
}
149153
}

src/Nest/Resolvers/ElasticContractResolver.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ protected override IList<JsonProperty> CreateProperties(Type type, MemberSeriali
9797
defaultProperties = PropertiesOf<IQuery>(type, memberSerialization, defaultProperties, lookup);
9898
defaultProperties = PropertiesOf<IQueryContainer>(type, memberSerialization, defaultProperties, lookup);
9999
defaultProperties = PropertiesOf<IRequest>(type, memberSerialization, defaultProperties, lookup);
100-
//defaultProperties = PropertiesOf<ISearchRequest>(type, memberSerialization, defaultProperties, lookup);
101100
defaultProperties = PropertiesOf<IFilter>(type, memberSerialization, defaultProperties, lookup, append: true);
102101
defaultProperties = PropertiesOf<IFilterContainer>(type, memberSerialization, defaultProperties, lookup);
103102
defaultProperties = PropertiesOf<IRandomScoreFunction>(type, memberSerialization, defaultProperties, lookup);

src/Nest/Resolvers/SettingsContractResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public SettingsContractResolver(IContractResolver wrapped, IConnectionSettingsVa
2626
{
2727
this.ConnectionSettings = connectionSettings;
2828
this.Infer = new ElasticInferrer(this.ConnectionSettings);
29-
this._wrapped = wrapped;
29+
this._wrapped = wrapped ?? new DefaultContractResolver();
3030
}
3131

3232
public JsonContract ResolveContract(Type type)

0 commit comments

Comments
 (0)