Skip to content

Commit 24ca419

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/extensible-values-source
Note: mutes AggregatorTestCase#testSupportedFieldTypes() temporarily, as the fix will require a bit more work than I'm comfortable doing in a merge commit.
2 parents 8fbff73 + 437273f commit 24ca419

File tree

52 files changed

+1288
-218
lines changed

Some content is hidden

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

52 files changed

+1288
-218
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,21 +1106,25 @@ public void testGetAliasesNonExistentIndexOrAlias() throws IOException {
11061106
highLevelClient().indices()::getAliasAsync);
11071107
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
11081108
assertThat(getAliasesResponse.getError(), equalTo("alias [" + alias + "] missing"));
1109+
assertThat(getAliasesResponse.getException(), nullValue());
11091110
}
11101111
createIndex(index, Settings.EMPTY);
11111112
client().performRequest(new Request(HttpPut.METHOD_NAME, index + "/_alias/" + alias));
11121113
{
11131114
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index, "non_existent_index");
11141115
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
11151116
highLevelClient().indices()::getAliasAsync);
1117+
assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
11161118
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
1119+
assertThat(getAliasesResponse.getError(), nullValue());
11171120
assertThat(getAliasesResponse.getException().getMessage(),
11181121
equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
11191122
}
11201123
{
11211124
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index, "non_existent_index").aliases(alias);
11221125
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
11231126
highLevelClient().indices()::getAliasAsync);
1127+
assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
11241128
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
11251129
assertThat(getAliasesResponse.getException().getMessage(),
11261130
equalTo("Elasticsearch exception [type=index_not_found_exception, reason=no such index [non_existent_index]]"));
@@ -1129,13 +1133,17 @@ public void testGetAliasesNonExistentIndexOrAlias() throws IOException {
11291133
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices("non_existent_index*");
11301134
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
11311135
highLevelClient().indices()::getAliasAsync);
1136+
assertThat(getAliasesResponse.status(), equalTo(RestStatus.OK));
11321137
assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
1138+
assertThat(getAliasesResponse.getException(), nullValue());
1139+
assertThat(getAliasesResponse.getError(), nullValue());
11331140
}
11341141
{
11351142
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().indices(index).aliases(alias, "non_existent_alias");
11361143
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
11371144
highLevelClient().indices()::getAliasAsync);
11381145
assertThat(getAliasesResponse.status(), equalTo(RestStatus.NOT_FOUND));
1146+
assertThat(getAliasesResponse.getError(), equalTo("alias [non_existent_alias] missing"));
11391147

11401148
assertThat(getAliasesResponse.getAliases().size(), equalTo(1));
11411149
assertThat(getAliasesResponse.getAliases().get(index).size(), equalTo(1));
@@ -1155,6 +1163,13 @@ public void testGetAliasesNonExistentIndexOrAlias() throws IOException {
11551163
}
11561164
*/
11571165
}
1166+
{
1167+
GetAliasesRequest getAliasesRequest = new GetAliasesRequest().aliases("non_existent_alias*");
1168+
GetAliasesResponse getAliasesResponse = execute(getAliasesRequest, highLevelClient().indices()::getAlias,
1169+
highLevelClient().indices()::getAliasAsync);
1170+
assertThat(getAliasesResponse.status(), equalTo(RestStatus.OK));
1171+
assertThat(getAliasesResponse.getAliases().size(), equalTo(0));
1172+
}
11581173
}
11591174

11601175
public void testIndexPutSettings() throws IOException {

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109

110110
import static org.hamcrest.Matchers.equalTo;
111111
import static org.hamcrest.Matchers.hasSize;
112+
import static org.hamcrest.Matchers.nullValue;
112113

113114
/**
114115
* This class is used to generate the Java Indices API documentation.
@@ -1909,8 +1910,17 @@ public void testGetAlias() throws Exception {
19091910
Map<String, Set<AliasMetaData>> aliases = response.getAliases(); // <1>
19101911
// end::get-alias-response
19111912

1913+
// tag::get-alias-response-error
1914+
RestStatus status = response.status(); // <1>
1915+
ElasticsearchException exception = response.getException(); // <2>
1916+
String error = response.getError(); // <3>
1917+
// end::get-alias-response-error
1918+
19121919
assertThat(response.getAliases().get("index").size(), equalTo(1));
19131920
assertThat(response.getAliases().get("index").iterator().next().alias(), equalTo("alias"));
1921+
assertThat(status, equalTo(RestStatus.OK));
1922+
assertThat(error, nullValue());
1923+
assertThat(exception, nullValue());
19141924

19151925
// tag::get-alias-execute-listener
19161926
ActionListener<GetAliasesResponse> listener =

docs/java-rest/high-level/indices/get_alias.asciidoc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,24 @@ executed operation as follows:
6262
--------------------------------------------------
6363
include-tagged::{doc-tests-file}[{api}-response]
6464
--------------------------------------------------
65-
<1> Retrieves a map of indices and their aliases
65+
<1> Retrieves a map of indices and their aliases
66+
67+
+{response}+ class contains information about errors if they occurred.
68+
This info could be in fields `error` or `exception` depends on a case.
69+
70+
["source","java",subs="attributes,callouts,macros"]
71+
--------------------------------------------------
72+
include-tagged::{doc-tests-file}[{api}-response-error]
73+
--------------------------------------------------
74+
<1> Client sets status to `NOT_FOUND` if at least one item of specified
75+
indices or aliases is not found. Otherwise it is `OK`.
76+
77+
<2> If at least one item of specified indices isn't exist client sets
78+
`ElasticsearchException` and returns empty result.
79+
80+
<3> If at least one item of specified aliases ins't exist client puts
81+
error description in `error` field and returns partial result if any
82+
of other patterns match.
83+
84+
If user specified indices or aliases as regular expressions
85+
and nothing was found client returns `OK` status and no errors.

docs/reference/ml/anomaly-detection/apis/put-job.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ A detector has the following properties:
7878
(string)
7979
include::{docdir}/ml/ml-shared.asciidoc[tag=by-field-name]
8080

81-
`analysis_config`.`detectors`.`custom_rules`::::
81+
[[put-customrules]]`analysis_config`.`detectors`.`custom_rules`::::
8282
+
8383
--
8484
(array)

docs/reference/modules/cross-cluster-search.asciidoc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ filter and analyze log data stored on clusters in different data centers.
88

99
IMPORTANT: {ccs-cap} requires <<modules-remote-clusters, remote clusters>>.
1010

11+
[float]
12+
[[ccs-supported-apis]]
13+
== Supported APIs
14+
15+
The following APIs support {ccs}:
16+
17+
* <<search-search,Search>>
18+
* <<search-multi-search,Multi search>>
19+
* <<search-template,Search template>>
20+
* <<multi-search-template,Multi search template>>
21+
1122
[float]
1223
[[ccs-example]]
1324
== {ccs-cap} examples
@@ -55,7 +66,7 @@ PUT _cluster/settings
5566
[[ccs-search-remote-cluster]]
5667
=== Search a single remote cluster
5768

58-
The following <<search,search>> API request searches the
69+
The following <<search-search,search>> API request searches the
5970
`twitter` index on a single remote cluster, `cluster_one`.
6071

6172
[source,console]
@@ -280,13 +291,12 @@ including a <<request-body-search-scroll, scroll>> or
280291
+
281292
See <<ccs-min-roundtrips>> to learn how this option works.
282293

283-
<<ccs-unmin-roundtrips, Don't minimize network roundtrips>>::
284-
For search requests that include a scroll or inner hits, {es} sends multiple
285-
outgoing and ingoing requests to each remote cluster. You can also choose this
286-
option by setting the <<search,search>> API's
287-
<<ccs-minimize-roundtrips,`ccs_minimize_roundtrips`>> parameter to `false`.
288-
While typically slower, this approach may work well for networks with low
289-
latency.
294+
<<ccs-unmin-roundtrips, Don't minimize network roundtrips>>:: For search
295+
requests that include a scroll or inner hits, {es} sends multiple outgoing and
296+
ingoing requests to each remote cluster. You can also choose this option by
297+
setting the <<ccs-minimize-roundtrips,`ccs_minimize_roundtrips`>> parameter to
298+
`false`. While typically slower, this approach may work well for networks with
299+
low latency.
290300
+
291301
See <<ccs-unmin-roundtrips>> to learn how this option works.
292302

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ scores be positive or `0`.
4848
--
4949

5050
`min_score`::
51-
(Optional, float) Documents with a <<relevance-scores,relevance score>> lower
51+
(Optional, float) Documents with a score lower
5252
than this floating point number are excluded from the search results.
5353

54+
`boost`::
55+
(Optional, float) Documents' scores produced by `script` are
56+
multiplied by `boost` to produce final documents' scores. Defaults to `1.0`.
5457

5558
[[script-score-query-notes]]
5659
==== Notes

docs/reference/sql/functions/grouping.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ actually used will be `INTERVAL '2' DAY`. If the interval specified is less than
8787

8888
[IMPORTANT]
8989
All intervals specified for a date/time HISTOGRAM will use a <<search-aggregations-bucket-datehistogram-aggregation,fixed interval>>
90-
in their `date_histogram` aggregation definition, with the notable exception of `INTERVAL '1' YEAR` where a calendar interval is used.
91-
The choice for a calendar interval was made for having a more intuitive result for YEAR groupings. Calendar intervals consider a one year
90+
in their `date_histogram` aggregation definition, with the notable exceptions of `INTERVAL '1' YEAR` AND `INTERVAL '1' MONTH` where a calendar interval is used.
91+
The choice for a calendar interval was made for having a more intuitive result for YEAR and MONTH groupings. In the case of YEAR, for example, the calendar intervals consider a one year
9292
bucket as the one starting on January 1st that specific year, whereas a fixed interval one-year-bucket considers one year as a number
9393
of milliseconds (for example, `31536000000ms` corresponding to 365 days, 24 hours per day, 60 minutes per hour etc.). With fixed intervals,
9494
the day of February 5th, 2019 for example, belongs to a bucket that starts on December 20th, 2018 and {es} (and implicitly {es-sql}) would
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Integration tests for ScriptScoreQuery using Painless
2+
setup:
3+
- skip:
4+
version: " - 7.9.99"
5+
reason: "boost was corrected in script_score query from 8.0"
6+
- do:
7+
indices.create:
8+
index: test_index
9+
body:
10+
settings:
11+
index:
12+
number_of_shards: 1
13+
number_of_replicas: 0
14+
mappings:
15+
properties:
16+
k:
17+
type: keyword
18+
i:
19+
type: integer
20+
21+
- do:
22+
bulk:
23+
index: test_index
24+
refresh: true
25+
body:
26+
- '{"index": {"_id": "1"}}'
27+
- '{"k": "k", "i" : 1}'
28+
- '{"index": {"_id": "2"}}'
29+
- '{"k": "kk", "i" : 2}'
30+
- '{"index": {"_id": "3"}}'
31+
- '{"k": "kkk", "i" : 3}'
32+
---
33+
"Boost script_score":
34+
- do:
35+
search:
36+
index: test_index
37+
body:
38+
query:
39+
script_score:
40+
query: {match_all: {}}
41+
script:
42+
source: "doc['i'].value * _score"
43+
boost: 10
44+
45+
- match: { hits.total.value: 3 }
46+
- match: { hits.hits.0._score: 30 }
47+
- match: { hits.hits.1._score: 20 }
48+
- match: { hits.hits.2._score: 10 }
49+
50+
---
51+
"Boost script_score and boost internal query":
52+
- do:
53+
search:
54+
index: test_index
55+
body:
56+
query:
57+
script_score:
58+
query: {match_all: {boost: 5}}
59+
script:
60+
source: "doc['i'].value * _score"
61+
boost: 10
62+
63+
- match: { hits.total.value: 3 }
64+
- match: { hits.hits.0._score: 150 }
65+
- match: { hits.hits.1._score: 100 }
66+
- match: { hits.hits.2._score: 50 }
67+
68+
---
69+
"Boost script_score with explain":
70+
- do:
71+
search:
72+
index: test_index
73+
body:
74+
explain: true
75+
query:
76+
script_score:
77+
query: {term: {"k": "kkk"}}
78+
script:
79+
source: "doc['i'].value"
80+
boost: 10
81+
82+
- match: { hits.total.value: 1 }
83+
- match: { hits.hits.0._score: 30 }
84+
- match: { hits.hits.0._explanation.value: 30 }
85+
- match: { hits.hits.0._explanation.details.0.description: "boost" }
86+
- match: { hits.hits.0._explanation.details.0.value: 10}

qa/os/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.packaging.util.FileUtils;
2525
import org.elasticsearch.packaging.util.Shell;
2626
import org.junit.BeforeClass;
27-
import org.junit.Ignore;
2827

2928
import java.util.regex.Pattern;
3029

@@ -38,7 +37,6 @@ public static void filterDistros() {
3837
assumeTrue("only deb", distribution.packaging == Distribution.Packaging.DEB);
3938
}
4039

41-
@Ignore // awaits fix: https://github.com/elastic/elasticsearch/issues/52554
4240
public void test05CheckLintian() {
4341
String extraArgs = "";
4442
if (sh.run("lintian --help").stdout.contains("fail-on-warnings")) {

0 commit comments

Comments
 (0)