Skip to content

Commit cfa1af6

Browse files
authored
Merge pull request #3455 from elastic/6.4
Add implemented 6.4.0 features to 6.x
2 parents b2bac81 + ab5cc0d commit cfa1af6

File tree

465 files changed

+10257
-3499
lines changed

Some content is hidden

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

465 files changed

+10257
-3499
lines changed

.paket/Paket.Restore.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@
144144
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
145145
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
146146
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
147+
<CopyLocal>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
147148
</PaketReferencesFileLinesInfo>
148149
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
149150
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
150151
<PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
151-
<ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
152+
<ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
152153
<Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
153154
</PackageReference>
154155
</ItemGroup>

build/scripts/Commandline.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ NOTE: both the `test` and `integrate` targets can be suffixed with `-all` to for
4141
Execution hints can be provided anywhere on the command line
4242
- skiptests : skip running tests as part of the target chain
4343
- skipdocs : skip generating documentation
44+
- docs:<B> : the branch name B to use when generating documentation
4445
- seed:<N> : provide a seed to run the tests with.
4546
- random:<K><:B> : sets random K to bool B if if B is omitted will default to true
4647
K can be: sourceserializer, typedkeys or oldconnection (only valid on windows)

build/scripts/Targets.fsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ open Commandline
3333
open Differ
3434
open Differ.Differ
3535
open Fake.IO
36+
open Octokit
3637

3738
Commandline.parse()
3839

@@ -107,14 +108,22 @@ Target "Cluster" <| fun _ ->
107108
let clusterVersion = getBuildParam "clusterVersion"
108109
let testsProjectDirectory = Path.Combine(Path.GetFullPath(Paths.Output("Tests.ClusterLauncher")), "netcoreapp2.1")
109110
let tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
111+
112+
let sourceDir = Paths.Source("Tests/Tests.Configuration");
113+
let defaultYaml = Path.Combine(sourceDir, "tests.default.yaml");
114+
let userYaml = Path.Combine(sourceDir, "tests.yaml");
115+
let e f = File.Exists f;
116+
match ((e userYaml), (e defaultYaml)) with
117+
| (true, _) -> setProcessEnvironVar "NEST_YAML_FILE" (Path.GetFullPath(userYaml))
118+
| (_, true) -> setProcessEnvironVar "NEST_YAML_FILE" (Path.GetFullPath(defaultYaml))
119+
| _ -> ignore()
120+
110121
Shell.copyDir tempDir testsProjectDirectory (fun s -> true)
111-
trace testsProjectDirectory
112-
trace tempDir
113122
let command = sprintf "%s %s" clusterName clusterVersion
114123
DotNetCli.RunCommand(fun p ->
115124
{ p with
116125
WorkingDir = tempDir;
117-
TimeOut = TimeSpan.FromMinutes(60.)
126+
TimeOut = TimeSpan.FromMinutes(120.)
118127
}) (sprintf "%s %s" (Path.Combine(tempDir, "Tests.ClusterLauncher.dll")) command)
119128

120129
Shell.deleteDir tempDir

docs/aggregations.asciidoc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
////
55
IMPORTANT NOTE
66
==============
7-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/aggregations.asciidoc.
7+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/master/src/Tests/Tests/aggregations.asciidoc.
88
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
99
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1010
////
@@ -62,6 +62,8 @@ The values are typically extracted from the fields of the document (using the fi
6262

6363
* <<value-count-aggregation-usage,Value Count Aggregation Usage>>
6464

65+
* <<weighted-average-aggregation-usage,Weighted Average Aggregation Usage>>
66+
6567
See the Elasticsearch documentation on {ref_current}/search-aggregations-metrics.html[Metric aggregations] for more details.
6668

6769
:includes-from-dirs: aggregations/metric
@@ -94,6 +96,8 @@ include::aggregations/metric/top-hits/top-hits-aggregation-usage.asciidoc[]
9496

9597
include::aggregations/metric/value-count/value-count-aggregation-usage.asciidoc[]
9698

99+
include::aggregations/metric/weighted-average/weighted-average-aggregation-usage.asciidoc[]
100+
97101
[[bucket-aggregations]]
98102
== Bucket Aggregations
99103

@@ -233,6 +237,8 @@ There are many different types of pipeline aggregation, each computing different
233237

234238
* <<moving-average-simple-aggregation-usage,Moving Average Simple Aggregation Usage>>
235239

240+
* <<moving-function-aggregation-usage,Moving Function Aggregation Usage>>
241+
236242
* <<percentiles-bucket-aggregation-usage,Percentiles Bucket Aggregation Usage>>
237243

238244
* <<serial-differencing-aggregation-usage,Serial Differencing Aggregation Usage>>
@@ -273,6 +279,8 @@ include::aggregations/pipeline/moving-average/moving-average-linear-aggregation-
273279

274280
include::aggregations/pipeline/moving-average/moving-average-simple-aggregation-usage.asciidoc[]
275281

282+
include::aggregations/pipeline/moving-function/moving-function-aggregation-usage.asciidoc[]
283+
276284
include::aggregations/pipeline/percentiles-bucket/percentiles-bucket-aggregation-usage.asciidoc[]
277285

278286
include::aggregations/pipeline/serial-differencing/serial-differencing-aggregation-usage.asciidoc[]

docs/aggregations/aggregation-meta-usage.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/AggregationMetaUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/AggregationMetaUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////

docs/aggregations/bucket/adjacency-matrix/adjacency-matrix-usage.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/Bucket/AdjacencyMatrix/AdjacencyMatrixUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/Bucket/AdjacencyMatrix/AdjacencyMatrixUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////

docs/aggregations/bucket/children/children-aggregation-usage.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/Bucket/Children/ChildrenAggregationUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/Bucket/Children/ChildrenAggregationUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////

docs/aggregations/bucket/composite/composite-aggregation-usage.asciidoc

Lines changed: 132 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/Bucket/Composite/CompositeAggregationUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/Bucket/Composite/CompositeAggregationUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////
@@ -145,7 +145,7 @@ new CompositeAggregation("my_buckets")
145145

146146
==== Handling Responses
147147

148-
Each Composite aggregation bucket key is an `CompositeKey`, a specialized
148+
Each Composite aggregation bucket key is a `CompositeKey` type, a specialized
149149
`IReadOnlyDictionary<string, object>` type with methods to convert values to supported types
150150

151151
[source,csharp]
@@ -185,3 +185,133 @@ foreach (var item in composite.Buckets)
185185
}
186186
----
187187

188+
[float]
189+
=== Missing buckets
190+
191+
By default documents without a value for a given source are ignored.
192+
It is possible to include them in the response by setting missing_bucket to `true` (defaults to `false`):
193+
194+
NOTE: Only available in Elasticsearch 6.4.0+
195+
196+
==== Fluent DSL example
197+
198+
[source,csharp]
199+
----
200+
a => a
201+
.Composite("my_buckets", date => date
202+
.Sources(s => s
203+
.Terms("branches", t => t
204+
.Field(f => f.Branches.Suffix("keyword"))
205+
.MissingBucket()
206+
.Order(SortOrder.Ascending)
207+
)
208+
)
209+
.Aggregations(childAggs => childAggs
210+
.Nested("project_tags", n => n
211+
.Path(p => p.Tags)
212+
.Aggregations(nestedAggs => nestedAggs
213+
.Terms("tags", avg => avg.Field(p => p.Tags.First().Name))
214+
)
215+
)
216+
)
217+
)
218+
----
219+
220+
==== Object Initializer syntax example
221+
222+
[source,csharp]
223+
----
224+
new CompositeAggregation("my_buckets")
225+
{
226+
Sources = new List<ICompositeAggregationSource>
227+
{
228+
new TermsCompositeAggregationSource("branches")
229+
{
230+
Field = Infer.Field<Project>(f => f.Branches.Suffix("keyword")),
231+
MissingBucket = true,
232+
Order = SortOrder.Ascending
233+
}
234+
},
235+
Aggregations = new NestedAggregation("project_tags")
236+
{
237+
Path = Field<Project>(p => p.Tags),
238+
Aggregations = new TermsAggregation("tags")
239+
{
240+
Field = Field<Project>(p => p.Tags.First().Name)
241+
}
242+
}
243+
}
244+
----
245+
246+
[source,javascript]
247+
.Example json output
248+
----
249+
{
250+
"my_buckets": {
251+
"composite": {
252+
"sources": [
253+
{
254+
"branches": {
255+
"terms": {
256+
"field": "branches.keyword",
257+
"order": "asc",
258+
"missing_bucket": true
259+
}
260+
}
261+
}
262+
]
263+
},
264+
"aggs": {
265+
"project_tags": {
266+
"nested": {
267+
"path": "tags"
268+
},
269+
"aggs": {
270+
"tags": {
271+
"terms": {
272+
"field": "tags.name"
273+
}
274+
}
275+
}
276+
}
277+
}
278+
}
279+
}
280+
----
281+
282+
==== Handling Responses
283+
284+
Each Composite aggregation bucket key is an `CompositeKey`, a specialized
285+
`IReadOnlyDictionary<string, object>` type with methods to convert values to supported types
286+
287+
[source,csharp]
288+
----
289+
response.ShouldBeValid();
290+
291+
var composite = response.Aggregations.Composite("my_buckets");
292+
composite.Should().NotBeNull();
293+
composite.Buckets.Should().NotBeNullOrEmpty();
294+
composite.AfterKey.Should().NotBeNull();
295+
296+
if (TestConfiguration.Instance.InRange(">=6.3.0"))
297+
composite.AfterKey.Should().HaveCount(1).And.ContainKeys("branches");
298+
299+
var i = 0;
300+
foreach (var item in composite.Buckets)
301+
{
302+
var key = item.Key;
303+
key.Should().NotBeNull();
304+
305+
key.TryGetValue("branches", out string branches).Should().BeTrue("expected to find 'branches' in composite bucket");
306+
if (i == 0) branches.Should().BeNull("First key should be null as we expect to have some projects with no branches");
307+
else branches.Should().NotBeNullOrEmpty();
308+
309+
var nested = item.Nested("project_tags");
310+
nested.Should().NotBeNull();
311+
312+
var nestedTerms = nested.Terms("tags");
313+
nestedTerms.Buckets.Count.Should().BeGreaterThan(0);
314+
i++;
315+
}
316+
----
317+

docs/aggregations/bucket/date-histogram/date-histogram-aggregation-usage.asciidoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/Bucket/DateHistogram/DateHistogramAggregationUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/Bucket/DateHistogram/DateHistogramAggregationUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////
@@ -114,14 +114,12 @@ new DateHistogramAggregation("projects_started_per_month")
114114
}
115115
----
116116

117-
=== Handling responses
117+
==== Handling responses
118118

119119
The `AggregateDictionary found on `.Aggregations` on `ISearchResponse<T>` has several helper methods
120120
so we can fetch our aggregation results easily in the correct type.
121121
<<handling-aggregate-response, Be sure to read more about these helper methods>>
122122

123-
==== Handling Responses
124-
125123
[source,csharp]
126124
----
127125
response.ShouldBeValid();

docs/aggregations/bucket/date-range/date-range-aggregation-usage.asciidoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
////
88
IMPORTANT NOTE
99
==============
10-
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Aggregations/Bucket/DateRange/DateRangeAggregationUsageTests.cs.
10+
This file has been generated from https://github.com/elastic/elasticsearch-net/tree/6.x/src/Tests/Tests/Aggregations/Bucket/DateRange/DateRangeAggregationUsageTests.cs.
1111
If you wish to submit a PR for any spelling mistakes, typos or grammatical errors for this file,
1212
please modify the original csharp file found at the link and submit the PR with that change. Thanks!
1313
////
@@ -93,14 +93,12 @@ new DateRangeAggregation("projects_date_ranges")
9393
}
9494
----
9595

96-
=== Handling Responses
96+
==== Handling Responses
9797

9898
The `AggregateDictionary found on `.Aggregations` on `ISearchResponse<T>` has several helper methods
9999
so we can fetch our aggregation results easily in the correct type.
100100
<<handling-aggregate-response, Be sure to read more about these helper methods>>
101101

102-
==== Handling Responses
103-
104102
[source,csharp]
105103
----
106104
response.ShouldBeValid();

0 commit comments

Comments
 (0)