Skip to content

Commit e1b059b

Browse files
committed
Merge branch '7.x' into peer-recovery-retention-leases-7.x
2 parents d225b78 + 9e901c5 commit e1b059b

File tree

71 files changed

+1299
-1116
lines changed

Some content is hidden

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

71 files changed

+1299
-1116
lines changed

docs/painless/painless-guide/painless-datetime.asciidoc

+190-5
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ document is most commonly accessible through an input called `doc`.
541541
+
542542
[source,Painless]
543543
----
544-
def input = doc['input_datetime'].value;
544+
ZonedDateTime input = doc['input_datetime'].value;
545545
String output = input.format(DateTimeFormatter.ISO_INSTANT); <1>
546546
----
547547
<1> Note the use of a built-in DateTimeFormatter.
@@ -584,8 +584,8 @@ if (doc.containsKey('start') && doc.containsKey('end')) { <1>
584584
585585
if (doc['start'].size() > 0 && doc['end'].size() > 0) { <2>
586586
587-
def start = doc['start'].value;
588-
def end = doc['end'].value;
587+
ZonedDateTime start = doc['start'].value;
588+
ZonedDateTime end = doc['end'].value;
589589
long differenceInMillis = ChronoUnit.MILLIS.between(start, end);
590590
591591
// handle difference in times
@@ -660,7 +660,7 @@ preferred as there is no need to parse it for comparision.
660660
[source,Painless]
661661
----
662662
long now = params['now'];
663-
def inputDateTime = doc['input_datetime'];
663+
ZonedDateTime inputDateTime = doc['input_datetime'];
664664
long millisDateTime = zdt.toInstant().toEpochMilli();
665665
long elapsedTime = now - millisDateTime;
666666
----
@@ -712,9 +712,194 @@ long elapsedTime = now - millisDateTime;
712712
String nowString = params['now'];
713713
ZonedDateTime nowZdt = ZonedDateTime.parse(datetime); <1>
714714
long now = ZonedDateTime.toInstant().toEpochMilli();
715-
def inputDateTime = doc['input_datetime'];
715+
ZonedDateTime inputDateTime = doc['input_datetime'];
716716
long millisDateTime = zdt.toInstant().toEpochMilli();
717717
long elapsedTime = now - millisDateTime;
718718
----
719719
<1> Note this parses the same string datetime every time the script runs. Use a
720720
numeric datetime to avoid a significant performance hit.
721+
722+
==== Datetime Examples in Contexts
723+
724+
===== Load the Example Data
725+
726+
Run the following curl commands to load the data necessary for the context
727+
examples into an Elasticsearch cluster:
728+
729+
. Create {ref}/mapping.html[mappings] for the sample data.
730+
+
731+
[source,js]
732+
----
733+
PUT /messages
734+
{
735+
"mappings": {
736+
"properties": {
737+
"priority": {
738+
"type": "integer"
739+
},
740+
"datetime": {
741+
"type": "date"
742+
},
743+
"message": {
744+
"type": "text"
745+
}
746+
}
747+
}
748+
}
749+
----
750+
+
751+
// CONSOLE
752+
+
753+
. Load the sample data.
754+
+
755+
[source,js]
756+
----
757+
POST /_bulk
758+
{ "index" : { "_index" : "messages", "_id" : "1" } }
759+
{ "priority": 1, "datetime": "2019-07-17T12:13:14Z", "message": "m1" }
760+
{ "index" : { "_index" : "messages", "_id" : "2" } }
761+
{ "priority": 1, "datetime": "2019-07-24T01:14:59Z", "message": "m2" }
762+
{ "index" : { "_index" : "messages", "_id" : "3" } }
763+
{ "priority": 2, "datetime": "1983-10-14T00:36:42Z", "message": "m3" }
764+
{ "index" : { "_index" : "messages", "_id" : "4" } }
765+
{ "priority": 3, "datetime": "1983-10-10T02:15:15Z", "message": "m4" }
766+
{ "index" : { "_index" : "messages", "_id" : "5" } }
767+
{ "priority": 3, "datetime": "1983-10-10T17:18:19Z", "message": "m5" }
768+
{ "index" : { "_index" : "messages", "_id" : "6" } }
769+
{ "priority": 1, "datetime": "2019-08-03T17:19:31Z", "message": "m6" }
770+
{ "index" : { "_index" : "messages", "_id" : "7" } }
771+
{ "priority": 3, "datetime": "2019-08-04T17:20:00Z", "message": "m7" }
772+
{ "index" : { "_index" : "messages", "_id" : "8" } }
773+
{ "priority": 2, "datetime": "2019-08-04T18:01:01Z", "message": "m8" }
774+
{ "index" : { "_index" : "messages", "_id" : "9" } }
775+
{ "priority": 3, "datetime": "1983-10-10T19:00:45Z", "message": "m9" }
776+
{ "index" : { "_index" : "messages", "_id" : "10" } }
777+
{ "priority": 2, "datetime": "2019-07-23T23:39:54Z", "message": "m10" }
778+
----
779+
+
780+
// CONSOLE
781+
// TEST[continued]
782+
783+
===== Day-of-the-Week Bucket Aggregation Example
784+
785+
The following example uses a
786+
{ref}/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-script[terms aggregation]
787+
as part of the
788+
<<painless-bucket-script-agg-context, bucket script aggregation context>> to
789+
display the number of messages from each day-of-the-week.
790+
791+
[source,js]
792+
----
793+
GET /messages/_search?pretty=true
794+
{
795+
"aggs": {
796+
"day-of-week-count": {
797+
"terms": {
798+
"script": "return doc[\"datetime\"].value.getDayOfWeekEnum();"
799+
}
800+
}
801+
}
802+
}
803+
----
804+
// CONSOLE
805+
// TEST[continued]
806+
807+
===== Morning/Evening Bucket Aggregation Example
808+
809+
The following example uses a
810+
{ref}/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-script[terms aggregation]
811+
as part of the
812+
<<painless-bucket-script-agg-context, bucket script aggregation context>> to
813+
display the number of messages received in the morning versus the evening.
814+
815+
[source,js]
816+
----
817+
GET /messages/_search?pretty=true
818+
{
819+
"aggs": {
820+
"am-pm-count": {
821+
"terms": {
822+
"script": "return doc[\"datetime\"].value.getHour() < 12 ? \"AM\" : \"PM\";"
823+
}
824+
}
825+
}
826+
}
827+
----
828+
// CONSOLE
829+
// TEST[continued]
830+
831+
===== Age of a Message Script Field Example
832+
833+
The following example uses a
834+
{ref}/search-request-script-fields.html[script field] as part of the
835+
<<painless-field-context, field context>> to display the elapsed time between
836+
"now" and when a message was received.
837+
838+
[source,js]
839+
----
840+
GET /_search?pretty=true
841+
{
842+
"query" : {
843+
"match_all": {}
844+
},
845+
"script_fields" : {
846+
"message_age" : {
847+
"script" : {
848+
"source": "ZonedDateTime now = ZonedDateTime.ofInstant(Instant.ofEpochMilli(params[\"now\"]), ZoneId.of(\"Z\")); ZonedDateTime mdt = doc[\"datetime\"].value; String age; long years = mdt.until(now, ChronoUnit.YEARS); age = years + \"Y \"; mdt = mdt.plusYears(years); long months = mdt.until(now, ChronoUnit.MONTHS); age += months + \"M \"; mdt = mdt.plusMonths(months); long days = mdt.until(now, ChronoUnit.DAYS); age += days + \"D \"; mdt = mdt.plusDays(days); long hours = mdt.until(now, ChronoUnit.HOURS); age += hours + \"h \"; mdt = mdt.plusHours(hours); long minutes = mdt.until(now, ChronoUnit.MINUTES); age += minutes + \"m \"; mdt = mdt.plusMinutes(minutes); long seconds = mdt.until(now, ChronoUnit.SECONDS); age += hours + \"s\"; return age;",
849+
"params": {
850+
"now": 1574005645830
851+
}
852+
}
853+
}
854+
}
855+
}
856+
----
857+
// CONSOLE
858+
// TEST[continued]
859+
860+
The following shows the script broken into multiple lines:
861+
862+
[source,Painless]
863+
----
864+
ZonedDateTime now = ZonedDateTime.ofInstant(
865+
Instant.ofEpochMilli(params['now']), ZoneId.of('Z')); <1>
866+
ZonedDateTime mdt = doc['datetime'].value; <2>
867+
868+
String age;
869+
870+
long years = mdt.until(now, ChronoUnit.YEARS); <3>
871+
age = years + 'Y '; <4>
872+
mdt = mdt.plusYears(years); <5>
873+
874+
long months = mdt.until(now, ChronoUnit.MONTHS);
875+
age += months + 'M ';
876+
mdt = mdt.plusMonths(months);
877+
878+
long days = mdt.until(now, ChronoUnit.DAYS);
879+
age += days + 'D ';
880+
mdt = mdt.plusDays(days);
881+
882+
long hours = mdt.until(now, ChronoUnit.HOURS);
883+
age += hours + 'h ';
884+
mdt = mdt.plusHours(hours);
885+
886+
long minutes = mdt.until(now, ChronoUnit.MINUTES);
887+
age += minutes + 'm ';
888+
mdt = mdt.plusMinutes(minutes);
889+
890+
long seconds = mdt.until(now, ChronoUnit.SECONDS);
891+
age += hours + 's';
892+
893+
return age; <6>
894+
----
895+
<1> Parse the datetime "now" as input from the user-defined params.
896+
<2> Store the datetime the message was received as a `ZonedDateTime`.
897+
<3> Find the difference in years between "now" and the datetime the message was
898+
received.
899+
<4> Add the difference in years later returned in the format
900+
`Y <years> ...` for the age of a message.
901+
<5> Add the years so only the remainder of the months, days, etc. remain as the
902+
difference between "now" and the datetime the message was received. Repeat this
903+
pattern until the desired granularity is reached (seconds in this example).
904+
<6> Return the age of the message in the format
905+
`Y <years> M <months> D <days> h <hours> m <minutes> s <seconds>`.

docs/reference/aggregations/bucket/terms-aggregation.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ respective document counts in brackets:
162162
| 6 | Product F (2) | Product H (14) | Product H (28)
163163
| 7 | Product G (2) | Product I (10) | Product Q (2)
164164
| 8 | Product H (2) | Product Q (6) | Product D (1)
165-
| 9 | Product I (1) | Product J (8) |
165+
| 9 | Product I (1) | Product J (6) |
166166
| 10 | Product J (1) | Product C (4) |
167167

168168
|=========================================================

docs/reference/migration/migrate_7_3.asciidoc

+19-11
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@ your application to Elasticsearch 7.3.
99

1010
See also <<release-highlights>> and <<es-release-notes>>.
1111

12-
coming[7.3.0]
13-
1412
//NOTE: The notable-breaking-changes tagged regions are re-used in the
1513
//Installation and Upgrade Guide
1614

1715
//tag::notable-breaking-changes[]
18-
19-
// end::notable-breaking-changes[]
20-
16+
[discrete]
2117
[[breaking_73_mapping_changes]]
2218
=== Mapping changes
2319
`dense_vector` field now requires `dims` parameter, specifying the number of
2420
dimensions for document and query vectors for this field.
2521

26-
[float]
22+
[discrete]
2723
==== Defining multi-fields within multi-fields
2824

2925
Previously, it was possible to define a multi-field within a multi-field.
@@ -33,29 +29,41 @@ in 8.0. To resolve the issue, all instances of `fields` that occur within a
3329
chained `fields` blocks into a single level, or by switching to `copy_to` if
3430
appropriate.
3531

32+
[discrete]
3633
[[breaking_73_plugin_changes]]
3734
=== Plugins changes
3835

39-
[float]
36+
[discrete]
4037
==== IndexStorePlugin changes
4138

4239
IndexStore and DirectoryService have been replaced by a stateless and simple
4340
DirectoryFactory interface to create custom Lucene directory instances per shard.
4441

4542

46-
[float]
43+
[discrete]
4744
[[breaking_73_search_changes]]
48-
=== Search Changes
45+
=== Search changes
4946

50-
[float]
47+
[discrete]
5148
==== Deprecation of queries
5249

5350
The `common` query has been deprecated. The same functionality can be achieved
5451
by the `match` query if the total number of hits is not tracked.
5552

56-
[float]
53+
[discrete]
5754
===== Deprecation of query parameters
5855

5956
The `cutoff_frequency` parameter has been deprecated for `match` and `multi_match`
6057
queries. The same functionality can be achieved without any configuration provided
6158
that the total number of hits is not tracked.
59+
60+
[discrete]
61+
[[breaking_73_ccr_changes]]
62+
=== CCR changes
63+
64+
[discrete]
65+
==== Directly modifying aliases of follower indices is no longer allowed
66+
67+
Aliases are now replicated to a follower from its leader, so directly modifying
68+
aliases on follower indices is no longer allowed.
69+
// end::notable-breaking-changes[]

docs/reference/modules/indices/circuit_breaker.asciidoc

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ causing an OutOfMemoryError. Each breaker specifies a limit for how much memory
66
it can use. Additionally, there is a parent-level breaker that specifies the
77
total amount of memory that can be used across all breakers.
88

9-
These settings can be dynamically updated on a live cluster with the
10-
<<cluster-update-settings,cluster-update-settings>> API.
9+
Except where noted otherwise, these settings can be dynamically updated on a
10+
live cluster with the <<cluster-update-settings,cluster-update-settings>> API.
1111

1212
[[parent-circuit-breaker]]
1313
[float]
@@ -17,8 +17,9 @@ The parent-level breaker can be configured with the following settings:
1717

1818
`indices.breaker.total.use_real_memory`::
1919

20-
Whether the parent breaker should take real memory usage into account (`true`) or only
21-
consider the amount that is reserved by child circuit breakers (`false`). Defaults to `true`.
20+
_Static_ setting determining whether the parent breaker should take real
21+
memory usage into account (`true`) or only consider the amount that is
22+
reserved by child circuit breakers (`false`). Defaults to `true`.
2223

2324
`indices.breaker.total.limit`::
2425

docs/reference/query-dsl/boosting-query.asciidoc

+10-9
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ GET /_search
4040
[[boosting-top-level-params]]
4141
==== Top-level parameters for `boosting`
4242

43-
`positive` (Required)::
44-
Query you wish to run. Any returned documents must match this query.
43+
`positive`::
44+
(Required, query object) Query you wish to run. Any returned documents must
45+
match this query.
4546

46-
`negative` (Required)::
47+
`negative`::
4748
+
4849
--
49-
Query used to decrease the <<query-filter-context, relevance score>> of matching
50-
documents.
50+
(Required, query object) Query used to decrease the <<query-filter-context,
51+
relevance score>> of matching documents.
5152

5253
If a returned document matches the `positive` query and this query, the
5354
`boosting` query calculates the final <<query-filter-context, relevance score>>
@@ -57,7 +58,7 @@ for the document as follows:
5758
. Multiply the score by the `negative_boost` value.
5859
--
5960

60-
`negative_boost` (Required)::
61-
Floating point number between `0` and `1.0` used to decrease the
62-
<<query-filter-context, relevance scores>> of documents matching the `negative`
63-
query.
61+
`negative_boost`::
62+
(Required, float) Floating point number between `0` and `1.0` used to decrease
63+
the <<query-filter-context, relevance scores>> of documents matching the
64+
`negative` query.

docs/reference/query-dsl/constant-score-query.asciidoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ GET /_search
2929
`filter`::
3030
+
3131
--
32-
<<query-dsl-bool-query, Filter query>> you wish to run. Any returned documents
33-
must match this query. Required.
32+
(Required, query object) <<query-dsl-bool-query, Filter query>> you wish to run.
33+
Any returned documents must match this query.
3434

3535
Filter queries do not calculate <<query-filter-context, relevance scores>>. To
3636
speed up performance, {es} automatically caches frequently used filter queries.
3737
--
3838

3939
`boost`::
40-
Floating point number used as the constant <<query-filter-context, relevance
41-
score>> for every document matching the `filter` query. Default is `1.0`.
42-
Optional.
40+
(Optional, float) Floating point number used as the constant
41+
<<query-filter-context, relevance score>> for every document matching the
42+
`filter` query. Defaults to `1.0`.

0 commit comments

Comments
 (0)