Skip to content

Commit d3f89ba

Browse files
committed
Merge branch 'master' of github.com:elastic/elasticsearch-net
2 parents b2ee0c7 + b1bb263 commit d3f89ba

File tree

54 files changed

+661
-463
lines changed

Some content is hidden

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

54 files changed

+661
-463
lines changed

build.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ if errorlevel 1 (
1717
exit /b %errorlevel%
1818
)
1919

20-
21-
2220
SET TARGET="build"
2321
SET VERSION=
2422
SET ESVERSIONS=
@@ -27,7 +25,10 @@ SET SKIPTESTS=0
2725
SET APIKEY=
2826

2927

30-
IF /I "%1"=="skiptests" (set SKIPTESTS="1")
28+
IF /I "%1"=="skiptests" (
29+
set SKIPTESTS="1"
30+
SHIFT
31+
)
3132

3233
IF NOT [%1]==[] (set TARGET="%1")
3334

build/scripts/Building.fsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ open Fake
77
open Paths
88
open Projects
99

10-
let gitLink pdbDir =
10+
let gitLink pdbDir projectName =
1111
let exe = Paths.Tool("gitlink/lib/net45/GitLink.exe")
1212
ExecProcess(fun p ->
1313
p.FileName <- exe
14-
p.Arguments <- sprintf @". -u %s -d %s" Paths.Repository pdbDir
14+
p.Arguments <- sprintf @". -u %s -d %s -include %s" Paths.Repository pdbDir projectName
1515
) (TimeSpan.FromMinutes 5.0) |> ignore
1616

1717
type Build() =
@@ -28,8 +28,8 @@ type Build() =
2828
projects
2929
|> Seq.iter(fun project ->
3030
let path = (Paths.Quote project)
31-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path]
32-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet";]
31+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path; "--quiet"]
32+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet"]
3333
)
3434

3535
static member BuildFailure errors =
@@ -44,8 +44,8 @@ type Build() =
4444

4545
//eventhough this says desktop it still builds all the tfm's it just hints wich installed dnx version to use
4646
let path = (Paths.Quote project)
47-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path]
48-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release";]
47+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path; "--quiet"]
48+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet"]
4949
)
5050

5151
projects
@@ -57,8 +57,8 @@ type Build() =
5757
match projectName with
5858
| "Nest"
5959
| "Elasticsearch.Net" ->
60-
gitLink(Paths.Net45BinFolder projectName)
61-
gitLink(Paths.DotNet51BinFolder projectName)
60+
gitLink (Paths.Net45BinFolder projectName) projectName
61+
gitLink (Paths.DotNet51BinFolder projectName) projectName
6262
| _ -> ()
6363
CopyDir outputFolder binFolder allFiles
6464
)

build/scripts/Paths.fsx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -119,42 +119,45 @@ module Tooling =
119119
member this.Path = Paths.Tool(path)
120120
member this.Exec arguments = exec this.Path arguments
121121

122-
let private dotTraceCommandLineTools = "JetBrains.dotTrace.CommandLineTools.10.0.20151114.191633"
123-
let private buildToolsDirectory = Paths.Build("tools")
124-
let private dotTraceDirectory = sprintf "%s/%s" buildToolsDirectory dotTraceCommandLineTools
125-
126-
if (Directory.Exists(dotTraceDirectory) = false)
127-
then
128-
trace (sprintf "No JetBrains DotTrace tooling found in %s. Downloading now" buildToolsDirectory)
129-
let url = sprintf "https://d1opms6zj7jotq.cloudfront.net/resharper/%s.zip" dotTraceCommandLineTools
130-
let zipFile = sprintf "%s/%s.zip" buildToolsDirectory dotTraceCommandLineTools
131-
use webClient = new WebClient()
132-
webClient.DownloadFile(url, zipFile)
133-
System.IO.Compression.ZipFile.ExtractToDirectory(zipFile, dotTraceDirectory)
134-
File.Delete zipFile
135-
trace "JetBrains DotTrace tooling downloaded"
136-
137-
let NugetFile = "build/tools/nuget/nuget.exe"
138-
if (File.Exists(NugetFile) = false)
139-
then
140-
trace "Nuget not found %s. Downloading now"
141-
let url = "http://nuget.org/nuget.exe"
142-
Directory.CreateDirectory("build/tools/nuget") |> ignore
143-
use webClient = new WebClient()
144-
webClient.DownloadFile(url, NugetFile)
145-
trace "nuget downloaded"
146-
147-
type ProfilerTooling(path) =
122+
let NugetFile = fun _ ->
123+
let targetLocation = "build/tools/nuget/nuget.exe"
124+
if (not (File.Exists targetLocation))
125+
then
126+
trace "Nuget not found %s. Downloading now"
127+
let url = "http://nuget.org/nuget.exe"
128+
Directory.CreateDirectory("build/tools/nuget") |> ignore
129+
use webClient = new WebClient()
130+
webClient.DownloadFile(url, targetLocation)
131+
trace "nuget downloaded"
132+
targetLocation
133+
134+
type ProfilerTooling(path) =
135+
let dotTraceCommandLineTools = "JetBrains.dotTrace.CommandLineTools.10.0.20151114.191633"
136+
let buildToolsDirectory = Paths.Build("tools")
137+
let dotTraceDirectory = sprintf "%s/%s" buildToolsDirectory dotTraceCommandLineTools
138+
member this.Bootstrap = fun _ ->
139+
if (not (Directory.Exists dotTraceDirectory)) then
140+
trace (sprintf "No JetBrains DotTrace tooling found in %s. Downloading now" buildToolsDirectory)
141+
let url = sprintf "https://d1opms6zj7jotq.cloudfront.net/resharper/%s.zip" dotTraceCommandLineTools
142+
let zipFile = sprintf "%s/%s.zip" buildToolsDirectory dotTraceCommandLineTools
143+
use webClient = new WebClient()
144+
webClient.DownloadFile(url, zipFile)
145+
System.IO.Compression.ZipFile.ExtractToDirectory(zipFile, dotTraceDirectory)
146+
File.Delete zipFile
147+
trace "JetBrains DotTrace tooling downloaded"
148+
148149
member this.Path = sprintf "%s/%s" dotTraceDirectory path
149-
member this.Exec arguments = exec this.Path arguments
150+
member this.Exec arguments =
151+
this.Bootstrap()
152+
exec this.Path arguments
150153

151154
let GitLink = new NugetTooling("GitLink", "gitlink/lib/net45/gitlink.exe")
152155
let Node = new NugetTooling("node.js", "Node.js/node.exe")
153156
let private npmCli = "Npm/node_modules/npm/cli.js"
154157
let Npm = new NugetTooling("npm", npmCli)
155158
let XUnit = new NugetTooling("xunit.runner.console", "xunit.runner.console/tools/xunit.console.exe")
156159
let DotTraceProfiler = new ProfilerTooling("ConsoleProfiler.exe")
157-
let DotTraceReporter = new ProfilerTooling("Reporter.exe")
160+
let DotTraceReporter = new ProfilerTooling("Reporter.exe")
158161
let DotTraceSnapshotStats = new ProfilerTooling("SnapshotStat.exe")
159162

160163
//only used to boostrap fake itself

build/scripts/Releasing.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type Release() =
100100
ZipHelper.Unzip unzippedDir package
101101

102102
// rename NEST package id
103-
if (projectName.Equals("Nest", StringComparison.InvariantCultureIgnoreCase) = true)
103+
if (projectName.Equals("Nest", StringComparison.InvariantCultureIgnoreCase))
104104
then
105105
let nuspec = sprintf "%s/Nest.nuspec" unzippedDir
106106
FileHelper.RegexReplaceInFileWithEncoding
@@ -138,7 +138,7 @@ type Release() =
138138
static member PublishCanaryBuild accessKey =
139139
!! "build/output/_packages/*-ci*.nupkg"
140140
|> Seq.iter(fun f ->
141-
let success = Tooling.execProcess Tooling.NugetFile ["push"; f; accessKey; "-source"; "https://www.myget.org/F/elasticsearch-net/api/v2/package"]
141+
let success = Tooling.execProcess (Tooling.NugetFile()) ["push"; f; accessKey; "-source"; "https://www.myget.org/F/elasticsearch-net/api/v2/package"]
142142
match success with
143143
| 0 -> traceFAKE "publish to myget succeeded" |> ignore
144144
| _ -> failwith "publish to myget failed" |> ignore

docs/asciidoc/Aggregations/WritingAggregations.doc.asciidoc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,17 @@ on the request. Using LINQ's `.Aggregate()` method, each function can be applied
6262

6363
[source, csharp]
6464
----
65+
var aggregations = new List<Func<AggregationContainerDescriptor<CommitActivity>, IAggregationContainer>>
6566
{
66-
var aggregations = new List<Func<AggregationContainerDescriptor<CommitActivity>, IAggregationContainer>>
67-
{
68-
a => a.Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor)),
69-
a => a.Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor))
70-
};
71-
72-
return s => s
73-
.Aggregations(aggs => aggs
74-
.Children<CommitActivity>("name_of_child_agg", child => child
75-
.Aggregations(childAggs =>
76-
aggregations.Aggregate(childAggs, (acc, agg) => { agg(acc); return acc; })
77-
)
67+
a => a.Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor)),
68+
a => a.Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor))
69+
};
70+
return s => s
71+
.Aggregations(aggs => aggs
72+
.Children<CommitActivity>("name_of_child_agg", child => child
73+
.Aggregations(childAggs =>
74+
aggregations.Aggregate(childAggs, (acc, agg) => { agg(acc); return acc; })
7875
)
79-
);
80-
}
76+
)
77+
);
8178
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/ConnectionPooling.Doc.asciidoc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Connection pooling is the internal mechanism that takes care of registering what nodes there are in the cluster and which
33
we can use to issue client calls on.
44

5-
== SingleNodeConnectionPool
5+
== SingleNodeConnectionPool
66
The simplest of all connection pools, this takes a single `Uri` and uses that to connect to elasticsearch for all the calls
77
It doesn't opt in to sniffing and pinging behavior, and will never mark nodes dead or alive. The one `Uri` it holds is always
8-
ready to go.
8+
ready to go.
99

1010
[source, csharp]
1111
----
@@ -15,7 +15,7 @@ pool.Nodes.Should().HaveCount(1);
1515
var node = pool.Nodes.First();
1616
node.Uri.Port.Should().Be(9201);
1717
----
18-
This type of pool is hardwired to optout out sniffing
18+
This type of pool is hardwired to opt out of sniffing
1919

2020
[source, csharp]
2121
----
@@ -27,7 +27,7 @@ and pinging
2727
----
2828
pool.SupportsPinging.Should().BeFalse();
2929
----
30-
When you use the low ceremony ElasticClient constructor that takes a single Uri
30+
When you use the low ceremony ElasticClient constructor that takes a single Uri,
3131
We default to this SingleNodeConnectionPool
3232

3333
[source, csharp]
@@ -58,15 +58,15 @@ client = new ElasticClient(new ConnectionSettings(pool));
5858
----
5959
client.ConnectionSettings.ConnectionPool.Should().BeOfType<SingleNodeConnectionPool>();
6060
----
61-
== StaticConnectionPool
62-
The static connection pool is great if you have a known small sized cluster and do no want to enable
61+
== StaticConnectionPool
62+
The static connection pool is great if you have a known small sized cluster and do no want to enable
6363
sniffing to find out the cluster topology.
6464

6565
[source, csharp]
6666
----
6767
var uris = Enumerable.Range(9200, 5).Select(p => new Uri("http://localhost:" + p));
6868
----
69-
a connection pool can be seeded using an enumerable of `Uri`
69+
a connection pool can be seeded using an enumerable of `Uri`s
7070

7171
[source, csharp]
7272
----
@@ -82,7 +82,7 @@ var nodes = uris.Select(u=>new Node(u));
8282
----
8383
pool = new StaticConnectionPool(nodes);
8484
----
85-
This type of pool is hardwirted to optout out sniffing
85+
This type of pool is hardwired to opt out of sniffing
8686

8787
[source, csharp]
8888
----
@@ -105,9 +105,9 @@ var client = new ElasticClient(new ConnectionSettings(pool));
105105
----
106106
client.ConnectionSettings.ConnectionPool.Should().BeOfType<StaticConnectionPool>();
107107
----
108-
== SniffingConnectionPool
108+
== SniffingConnectionPool
109109
A subclass of StaticConnectionPool that allows itself to be reseeded at run time.
110-
It comes with a very minor overhead of a ReaderWriterLock to ensure thread safety.
110+
It comes with a very minor overhead of a `ReaderWriterLockSlim` to ensure thread safety.
111111

112112
[source, csharp]
113113
----
@@ -132,19 +132,19 @@ var nodes = uris.Select(u=>new Node(u));
132132
----
133133
pool = new SniffingConnectionPool(nodes);
134134
----
135-
This type of pool is hardwired to opt out of sniffing
135+
This type of pool is hardwired to opt in to sniffing
136136

137137
[source, csharp]
138138
----
139139
pool.SupportsReseeding.Should().BeTrue();
140140
----
141-
but supports pinging when enabled
141+
and pinging
142142

143143
[source, csharp]
144144
----
145145
pool.SupportsPinging.Should().BeTrue();
146146
----
147-
To create a client using this siffing connection pool pass
147+
To create a client using the sniffing connection pool pass
148148
the connection pool to the connectionsettings you pass to ElasticClient
149149

150150
[source, csharp]

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/DateTimeProviders.Doc.asciidoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= Date time providers
22

3-
Not typically something you'll have to pass to the client but all calls `to DateTime.Now`
4-
in the client have been abstracted by IDateTimeProvider. This allows us to unit test timeouts and clusterfailover
3+
Not typically something you'll have to pass to the client but all calls to `System.DateTime.UtcNow`
4+
in the client have been abstracted by `IDateTimeProvider`. This allows us to unit test timeouts and clusterfailover
55
in run time not being bound to wall clock time.
66

77
[source, csharp]
@@ -14,8 +14,8 @@ dates are always returned in UTC
1414
----
1515
dateTimeProvider.Now().Should().BeCloseTo(DateTime.UtcNow);
1616
----
17-
Another responsibility of this interface is to calculate the time a node has to taken out of rotation
18-
based on the number of attempts to revive it. For very advance usecases this might be something of interest
17+
Another responsibility of this interface is to calculate the time a node has to be taken out of rotation
18+
based on the number of attempts to revive it. For very advanced use cases, this might be something of interest
1919
to provide a custom implementation for.
2020

2121
[source, csharp]
@@ -38,8 +38,8 @@ Plotting these defaults looks as followed:
3838
[[timeout]]
3939
.Default formula, x-axis time in minutes, y-axis number of attempts to revive
4040
image::timeoutplot.png[dead timeout]
41-
The goal here is that whenever a node is resurected and is found to still be offline we send it
42-
back to the doghouse for an ever increasingly long period untill we hit a bounded maximum.
41+
The goal here is that whenever a node is resurrected and is found to still be offline, we send it
42+
_back to the doghouse_ for an ever increasingly long period, until we hit a bounded maximum.
4343

4444
[source, csharp]
4545
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/KeepingTrackOfNodes.Doc.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
=
1+
= Keeping track of nodes
22

33

44
[source, csharp]
@@ -23,8 +23,8 @@ Is resurrected is true on first usage, hints to the transport that a ping might
2323
----
2424
node.IsResurrected.Should().BeTrue();
2525
----
26-
When instantiating your connection pool you could switch these to false to initialize the client to
27-
a known cluster topology.
26+
When instantiating your connection pool you could switch these to false to initialize the client to
27+
a known cluster topology.
2828

2929
passing a node with a path should be preserved. Sometimes an elasticsearch node lives behind a proxy
3030

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/RequestPipelines.doc.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
== Request pipeline
2-
Every request is executed in the context of `RequestPipeline` when you are using the default `ITransport` implementation.
1+
= Request pipeline
2+
Every request is executed in the context of `RequestPipeline` when using the default `ITransport` implementation.
33

44

55
[source, csharp]
@@ -34,7 +34,7 @@ which can be passed to the transport when instantiating a client
3434
----
3535
var transport = new Transport<ConnectionSettings>(settings, requestPipelineFactory, DateTimeProvider.Default, new MemoryStreamFactory());
3636
----
37-
this allows you to have requests executed on your own custom request pipeline
37+
this allows you to have requests executed on your own custom request pipeline
3838

3939
[source, csharp]
4040
----

docs/asciidoc/ClientConcepts/ConnectionPooling/BuildingBlocks/Transports.Doc.asciidoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
== Transports
2-
The ITransport interface can be seen as the motor block of the client. It's interface is deceitfully simple.
3-
Its ultimately responsible from translating a client call to a response. If for some reasons you do not agree with the way we wrote
4-
the internals of the client by implementing a custom ITransport you can circumvent all of it and introduce your own.
1+
= Transports
2+
The `ITransport` interface can be seen as the motor block of the client. It's interface is deceitfully simple.
3+
It's ultimately responsible from translating a client call to a response. If for some reason you do not agree with the way we wrote
4+
the internals of the client, by implementing a custom `ITransport`, you can circumvent all of it and introduce your own.
55

66

77
Transport is generically typed to a type that implements IConnectionConfigurationValues
88
This is the minimum ITransport needs to report back for the client to function.
9-
e.g in the low level client transport is instantiated like this:
9+
e.g in the low level client, transport is instantiated like this:
1010

1111
[source, csharp]
1212
----
1313
var lowLevelTransport = new Transport<ConnectionConfiguration>(new ConnectionConfiguration());
1414
----
15-
In the high level client like this.
15+
In the high level client like this:
1616

1717
[source, csharp]
1818
----
@@ -23,9 +23,9 @@ var highlevelTransport = new Transport<ConnectionSettings>(new ConnectionSetting
2323
var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
2424
var inMemoryTransport = new Transport<ConnectionSettings>(new ConnectionSettings(connectionPool, new InMemoryConnection()));
2525
----
26-
The only two methods on ITransport are Request and DoRequestAsync, the default ITransport implementation is responsible for introducing
27-
many of the building blocks in the client, if these do not work for you can swap them out for your own custom ITransport implementation.
28-
If you feel this need report back to us we would love to learn why you'd go down this route!
26+
The only two methods on `ITransport` are `Request()` and `RequestAsync()`, the default `ITransport` implementation is responsible for introducing
27+
many of the building blocks in the client, if these do not work for you can swap them out for your own custom `ITransport` implementation.
28+
If you feel this need, please let us know as we'd love to learn why you've go down this route!
2929

3030
[source, csharp]
3131
----

0 commit comments

Comments
 (0)