Skip to content

Commit 4beced5

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature-oidc-realm
2 parents 53c3061 + 3bb826a commit 4beced5

File tree

137 files changed

+2864
-4871
lines changed

Some content is hidden

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

137 files changed

+2864
-4871
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.client;
21+
22+
import org.apache.http.client.methods.HttpDelete;
23+
import org.apache.http.client.methods.HttpGet;
24+
import org.apache.http.client.methods.HttpPost;
25+
import org.apache.http.client.methods.HttpPut;
26+
import org.elasticsearch.action.support.ActiveShardCount;
27+
import org.elasticsearch.client.ccr.CcrStatsRequest;
28+
import org.elasticsearch.client.ccr.DeleteAutoFollowPatternRequest;
29+
import org.elasticsearch.client.ccr.FollowConfig;
30+
import org.elasticsearch.client.ccr.FollowInfoRequest;
31+
import org.elasticsearch.client.ccr.FollowStatsRequest;
32+
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
33+
import org.elasticsearch.client.ccr.PauseFollowRequest;
34+
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
35+
import org.elasticsearch.client.ccr.PutFollowRequest;
36+
import org.elasticsearch.client.ccr.ResumeFollowRequest;
37+
import org.elasticsearch.client.ccr.UnfollowRequest;
38+
import org.elasticsearch.common.unit.ByteSizeValue;
39+
import org.elasticsearch.common.unit.TimeValue;
40+
import org.elasticsearch.test.ESTestCase;
41+
42+
import java.util.Arrays;
43+
import java.util.Locale;
44+
45+
import static org.hamcrest.Matchers.equalTo;
46+
import static org.hamcrest.Matchers.nullValue;
47+
48+
public class CcrRequestConvertersTests extends ESTestCase {
49+
50+
public void testPutFollow() throws Exception {
51+
PutFollowRequest putFollowRequest = new PutFollowRequest(randomAlphaOfLength(4), randomAlphaOfLength(4), randomAlphaOfLength(4),
52+
randomBoolean() ? randomFrom(ActiveShardCount.NONE, ActiveShardCount.ONE, ActiveShardCount.DEFAULT, ActiveShardCount.ALL) : null
53+
);
54+
randomizeRequest(putFollowRequest);
55+
Request result = CcrRequestConverters.putFollow(putFollowRequest);
56+
assertThat(result.getMethod(), equalTo(HttpPut.METHOD_NAME));
57+
assertThat(result.getEndpoint(), equalTo("/" + putFollowRequest.getFollowerIndex() + "/_ccr/follow"));
58+
if (putFollowRequest.waitForActiveShards() != null && putFollowRequest.waitForActiveShards() != ActiveShardCount.DEFAULT) {
59+
String expectedValue = putFollowRequest.waitForActiveShards().toString().toLowerCase(Locale.ROOT);
60+
assertThat(result.getParameters().get("wait_for_active_shards"), equalTo(expectedValue));
61+
} else {
62+
assertThat(result.getParameters().size(), equalTo(0));
63+
}
64+
RequestConvertersTests.assertToXContentBody(putFollowRequest, result.getEntity());
65+
}
66+
67+
public void testPauseFollow() {
68+
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest(randomAlphaOfLength(4));
69+
Request result = CcrRequestConverters.pauseFollow(pauseFollowRequest);
70+
assertThat(result.getMethod(), equalTo(HttpPost.METHOD_NAME));
71+
assertThat(result.getEndpoint(), equalTo("/" + pauseFollowRequest.getFollowerIndex() + "/_ccr/pause_follow"));
72+
assertThat(result.getParameters().size(), equalTo(0));
73+
assertThat(result.getEntity(), nullValue());
74+
}
75+
76+
public void testResumeFollow() throws Exception {
77+
ResumeFollowRequest resumeFollowRequest = new ResumeFollowRequest(randomAlphaOfLength(4));
78+
Request result = CcrRequestConverters.resumeFollow(resumeFollowRequest);
79+
assertThat(result.getMethod(), equalTo(HttpPost.METHOD_NAME));
80+
assertThat(result.getEndpoint(), equalTo("/" + resumeFollowRequest.getFollowerIndex() + "/_ccr/resume_follow"));
81+
assertThat(result.getParameters().size(), equalTo(0));
82+
RequestConvertersTests.assertToXContentBody(resumeFollowRequest, result.getEntity());
83+
}
84+
85+
public void testUnfollow() {
86+
UnfollowRequest pauseFollowRequest = new UnfollowRequest(randomAlphaOfLength(4));
87+
Request result = CcrRequestConverters.unfollow(pauseFollowRequest);
88+
assertThat(result.getMethod(), equalTo(HttpPost.METHOD_NAME));
89+
assertThat(result.getEndpoint(), equalTo("/" + pauseFollowRequest.getFollowerIndex() + "/_ccr/unfollow"));
90+
assertThat(result.getParameters().size(), equalTo(0));
91+
assertThat(result.getEntity(), nullValue());
92+
}
93+
94+
public void testPutAutofollowPattern() throws Exception {
95+
PutAutoFollowPatternRequest putAutoFollowPatternRequest = new PutAutoFollowPatternRequest(randomAlphaOfLength(4),
96+
randomAlphaOfLength(4), Arrays.asList(generateRandomStringArray(4, 4, false)));
97+
if (randomBoolean()) {
98+
putAutoFollowPatternRequest.setFollowIndexNamePattern(randomAlphaOfLength(4));
99+
}
100+
randomizeRequest(putAutoFollowPatternRequest);
101+
102+
Request result = CcrRequestConverters.putAutoFollowPattern(putAutoFollowPatternRequest);
103+
assertThat(result.getMethod(), equalTo(HttpPut.METHOD_NAME));
104+
assertThat(result.getEndpoint(), equalTo("/_ccr/auto_follow/" + putAutoFollowPatternRequest.getName()));
105+
assertThat(result.getParameters().size(), equalTo(0));
106+
RequestConvertersTests.assertToXContentBody(putAutoFollowPatternRequest, result.getEntity());
107+
}
108+
109+
public void testDeleteAutofollowPattern() throws Exception {
110+
DeleteAutoFollowPatternRequest deleteAutoFollowPatternRequest = new DeleteAutoFollowPatternRequest(randomAlphaOfLength(4));
111+
112+
Request result = CcrRequestConverters.deleteAutoFollowPattern(deleteAutoFollowPatternRequest);
113+
assertThat(result.getMethod(), equalTo(HttpDelete.METHOD_NAME));
114+
assertThat(result.getEndpoint(), equalTo("/_ccr/auto_follow/" + deleteAutoFollowPatternRequest.getName()));
115+
assertThat(result.getParameters().size(), equalTo(0));
116+
assertThat(result.getEntity(), nullValue());
117+
}
118+
119+
public void testGetAutofollowPattern() throws Exception {
120+
GetAutoFollowPatternRequest deleteAutoFollowPatternRequest = new GetAutoFollowPatternRequest(randomAlphaOfLength(4));
121+
122+
Request result = CcrRequestConverters.getAutoFollowPattern(deleteAutoFollowPatternRequest);
123+
assertThat(result.getMethod(), equalTo(HttpGet.METHOD_NAME));
124+
assertThat(result.getEndpoint(), equalTo("/_ccr/auto_follow/" + deleteAutoFollowPatternRequest.getName()));
125+
assertThat(result.getParameters().size(), equalTo(0));
126+
assertThat(result.getEntity(), nullValue());
127+
}
128+
129+
public void testGetCcrStats() throws Exception {
130+
CcrStatsRequest ccrStatsRequest = new CcrStatsRequest();
131+
Request result = CcrRequestConverters.getCcrStats(ccrStatsRequest);
132+
assertThat(result.getMethod(), equalTo(HttpGet.METHOD_NAME));
133+
assertThat(result.getEndpoint(), equalTo("/_ccr/stats"));
134+
assertThat(result.getParameters().size(), equalTo(0));
135+
assertThat(result.getEntity(), nullValue());
136+
}
137+
138+
public void testGetFollowStats() throws Exception {
139+
FollowStatsRequest followStatsRequest = new FollowStatsRequest(randomAlphaOfLength(4));
140+
Request result = CcrRequestConverters.getFollowStats(followStatsRequest);
141+
assertThat(result.getMethod(), equalTo(HttpGet.METHOD_NAME));
142+
assertThat(result.getEndpoint(), equalTo("/" + followStatsRequest.getFollowerIndex() + "/_ccr/stats"));
143+
assertThat(result.getParameters().size(), equalTo(0));
144+
assertThat(result.getEntity(), nullValue());
145+
}
146+
147+
public void testGetFollowInfo() throws Exception {
148+
FollowInfoRequest followInfoRequest = new FollowInfoRequest(randomAlphaOfLength(4));
149+
Request result = CcrRequestConverters.getFollowInfo(followInfoRequest);
150+
assertThat(result.getMethod(), equalTo(HttpGet.METHOD_NAME));
151+
assertThat(result.getEndpoint(), equalTo("/" + followInfoRequest.getFollowerIndex() + "/_ccr/info"));
152+
assertThat(result.getParameters().size(), equalTo(0));
153+
assertThat(result.getEntity(), nullValue());
154+
}
155+
156+
private static void randomizeRequest(FollowConfig request) {
157+
if (randomBoolean()) {
158+
request.setMaxOutstandingReadRequests(randomIntBetween(0, Integer.MAX_VALUE));
159+
}
160+
if (randomBoolean()) {
161+
request.setMaxOutstandingWriteRequests(randomIntBetween(0, Integer.MAX_VALUE));
162+
}
163+
if (randomBoolean()) {
164+
request.setMaxReadRequestOperationCount(randomIntBetween(0, Integer.MAX_VALUE));
165+
}
166+
if (randomBoolean()) {
167+
request.setMaxReadRequestSize(new ByteSizeValue(randomNonNegativeLong()));
168+
}
169+
if (randomBoolean()) {
170+
request.setMaxWriteBufferCount(randomIntBetween(0, Integer.MAX_VALUE));
171+
}
172+
if (randomBoolean()) {
173+
request.setMaxWriteBufferSize(new ByteSizeValue(randomNonNegativeLong()));
174+
}
175+
if (randomBoolean()) {
176+
request.setMaxWriteRequestOperationCount(randomIntBetween(0, Integer.MAX_VALUE));
177+
}
178+
if (randomBoolean()) {
179+
request.setMaxWriteRequestSize(new ByteSizeValue(randomNonNegativeLong()));
180+
}
181+
if (randomBoolean()) {
182+
request.setMaxRetryDelay(new TimeValue(randomNonNegativeLong()));
183+
}
184+
if (randomBoolean()) {
185+
request.setReadPollTimeout(new TimeValue(randomNonNegativeLong()));
186+
}
187+
}
188+
189+
}

docs/reference/docs/concurrency-control.asciidoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PUT products/_doc/1567
3131
// CONSOLE
3232

3333
You can see the assigned sequence number and primary term in the
34-
the `_seq_no` and `_primary_term` fields of the response:
34+
`_seq_no` and `_primary_term` fields of the response:
3535

3636
[source,js]
3737
--------------------------------------------------
@@ -53,8 +53,8 @@ the `_seq_no` and `_primary_term` fields of the response:
5353
// TESTRESPONSE[s/"_seq_no" : \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 2/"_primary_term" : $body._primary_term/]
5454

5555

56-
Elasticsearch keeps tracks of the sequence number and primary of the last
57-
operation to have changed each of the document it stores. The sequence number
56+
Elasticsearch keeps tracks of the sequence number and primary term of the last
57+
operation to have changed each of the documents it stores. The sequence number
5858
and primary term are returned in the `_seq_no` and `_primary_term` fields in
5959
the response of the <<docs-get,GET API>>:
6060

docs/reference/docs/reindex.asciidoc

+13-13
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ POST _reindex
118118
// CONSOLE
119119
// TEST[setup:twitter]
120120

121-
By default version conflicts abort the `_reindex` process but you can just
122-
count them by settings `"conflicts": "proceed"` in the request body:
121+
By default, version conflicts abort the `_reindex` process, but you can just
122+
count them by setting `"conflicts": "proceed"` in the request body:
123123

124124
[source,js]
125125
--------------------------------------------------
@@ -423,7 +423,7 @@ POST _reindex
423423
// TEST[s/"password": "pass"//]
424424

425425
The `host` parameter must contain a scheme, host, port (e.g.
426-
`https://otherhost:9200`) and optional path (e.g. `https://otherhost:9200/proxy`).
426+
`https://otherhost:9200`), and optional path (e.g. `https://otherhost:9200/proxy`).
427427
The `username` and `password` parameters are optional, and when they are present `_reindex`
428428
will connect to the remote Elasticsearch node using basic auth. Be sure to use `https` when
429429
using basic auth or the password will be sent in plain text.
@@ -434,7 +434,7 @@ Remote hosts have to be explicitly whitelisted in elasticsearch.yml using the
434434
`reindex.remote.whitelist` property. It can be set to a comma delimited list
435435
of allowed remote `host` and `port` combinations (e.g.
436436
`otherhost:9200, another:9200, 127.0.10.*:9200, localhost:*`). Scheme is
437-
ignored by the whitelist - only host and port are used, for example:
437+
ignored by the whitelist -- only host and port are used, for example:
438438

439439

440440
[source,yaml]
@@ -618,7 +618,7 @@ Defaults to the keystore password. This setting cannot be used with
618618

619619
In addition to the standard parameters like `pretty`, the Reindex API also
620620
supports `refresh`, `wait_for_completion`, `wait_for_active_shards`, `timeout`,
621-
`scroll` and `requests_per_second`.
621+
`scroll`, and `requests_per_second`.
622622

623623
Sending the `refresh` url parameter will cause all indexes to which the request
624624
wrote to be refreshed. This is different than the Index API's `refresh`
@@ -642,7 +642,7 @@ the `scroll` parameter to control how long it keeps the "search context" alive,
642642
(e.g. `?scroll=10m`). The default value is 5 minutes.
643643

644644
`requests_per_second` can be set to any positive decimal number (`1.4`, `6`,
645-
`1000`, etc) and throttles the rate at which `_reindex` issues batches of index
645+
`1000`, etc.) and throttles the rate at which `_reindex` issues batches of index
646646
operations by padding each batch with a wait time. The throttling can be
647647
disabled by setting `requests_per_second` to `-1`.
648648

@@ -839,7 +839,7 @@ The response looks like:
839839
}
840840
--------------------------------------------------
841841
// TESTRESPONSE
842-
<1> this object contains the actual status. It is identical to the response JSON
842+
<1> This object contains the actual status. It is identical to the response JSON
843843
except for the important addition of the `total` field. `total` is the total number
844844
of operations that the `_reindex` expects to perform. You can estimate the
845845
progress by adding the `updated`, `created`, and `deleted` fields. The request
@@ -867,7 +867,7 @@ you to delete that document.
867867
[[docs-reindex-cancel-task-api]]
868868
=== Works with the Cancel Task API
869869

870-
Any Reindex can be canceled using the <<task-cancellation,Task Cancel API>>. For
870+
Any reindex can be canceled using the <<task-cancellation,Task Cancel API>>. For
871871
example:
872872

873873
[source,js]
@@ -900,8 +900,8 @@ The task ID can be found using the <<tasks,tasks API>>.
900900
Just like when setting it on the Reindex API, `requests_per_second`
901901
can be either `-1` to disable throttling or any decimal number
902902
like `1.7` or `12` to throttle to that level. Rethrottling that speeds up the
903-
query takes effect immediately but rethrotting that slows down the query will
904-
take effect on after completing the current batch. This prevents scroll
903+
query takes effect immediately, but rethrottling that slows down the query will
904+
take effect after completing the current batch. This prevents scroll
905905
timeouts.
906906

907907
[float]
@@ -1112,7 +1112,7 @@ be larger than others. Expect larger slices to have a more even distribution.
11121112
are distributed proportionally to each sub-request. Combine that with the point
11131113
above about distribution being uneven and you should conclude that the using
11141114
`size` with `slices` might not result in exactly `size` documents being
1115-
`_reindex`ed.
1115+
reindexed.
11161116
* Each sub-request gets a slightly different snapshot of the source index,
11171117
though these are all taken at approximately the same time.
11181118

@@ -1145,7 +1145,7 @@ partially completed index and starting over at that index. It also makes
11451145
parallelizing the process fairly simple: split the list of indices to reindex
11461146
and run each list in parallel.
11471147

1148-
One off bash scripts seem to work nicely for this:
1148+
One-off bash scripts seem to work nicely for this:
11491149

11501150
[source,bash]
11511151
----------------------------------------------------------------
@@ -1217,7 +1217,7 @@ GET metricbeat-2016.05.31-1/_doc/1
12171217
// CONSOLE
12181218
// TEST[continued]
12191219

1220-
The previous method can also be used in conjunction with <<docs-reindex-change-name, change the name of a field>>
1220+
The previous method can also be used in conjunction with <<docs-reindex-change-name, changing a field name>>
12211221
to load only the existing data into the new index and rename any fields if needed.
12221222

12231223
[float]

docs/reference/settings/notification-settings.asciidoc

+2-51
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
You configure {watcher} settings to set up {watcher} and send notifications via
99
<<email-notification-settings,email>>,
10-
<<hipchat-notification-settings,HipChat>>,
1110
<<slack-notification-settings,Slack>>, and
1211
<<pagerduty-notification-settings, PagerDuty>>.
1312

@@ -67,10 +66,10 @@ Specifies the maximum size an HTTP response is allowed to have, defaults to
6766

6867
`xpack.http.whitelist`::
6968
A list of URLs, that the internal HTTP client is allowed to connect to. This
70-
client is used in the HTTP input, the webhook, the slack, pagerduty, hipchat
69+
client is used in the HTTP input, the webhook, the slack, pagerduty,
7170
and jira actions. This setting can be updated dynamically. It defaults to `*`
7271
allowing everything. Note: If you configure this setting and you are using one
73-
of the slack/pagerduty/hipchat actions, you have to ensure that the
72+
of the slack/pagerduty actions, you have to ensure that the
7473
corresponding endpoints are whitelisted as well.
7574

7675
[[ssl-notification-settings]]
@@ -207,54 +206,6 @@ HTML feature groups>>.
207206
Set to `false` to completely disable HTML sanitation. Not recommended.
208207
Defaults to `true`.
209208

210-
[float]
211-
[[hipchat-notification-settings]]
212-
==== HipChat Notification Settings
213-
You can configure the following HipChat notification settings in
214-
`elasticsearch.yml`. For more information about sending notifications
215-
via HipChat, see {xpack-ref}/actions-hipchat.html#configuring-hipchat-actions[Configuring HipChat].
216-
217-
`xpack.notification.hipchat` ::
218-
Specifies account information for sending notifications
219-
via HipChat. You can specify the following HipChat account attributes:
220-
221-
[[hipchat-account-attributes]]
222-
`profile`;;
223-
The HipChat account profile to use: `integration`,
224-
`user`, or `v1`. Required.
225-
226-
`secure_auth_token` (<<secure-settings,Secure>>);;
227-
The authentication token to use to access the HipChat API. Required.
228-
229-
`host`;;
230-
The HipChat server hostname. Defaults to `api.hipchat.com`.
231-
232-
`port`;;
233-
The HipChat server port number. Defaults to 443.
234-
235-
`room`;;
236-
The room you want to send messages to. Must be specified
237-
if the `profile` is set to `integration`. Not valid for
238-
the `user` or `vi` profiles.
239-
240-
`user`;;
241-
The HipChat user account to use to send messages.
242-
Specified as an email address. Must be specified if the
243-
`profile` is set to `user`. Not valid for the `integration`
244-
or `v1` profiles.
245-
246-
`message.format`;;
247-
The format of the message: `text` or `html`.
248-
Defaults to `html`.
249-
250-
`message.color`;;
251-
The background color of the notification in the room.
252-
Defaults to `yellow`.
253-
`message.notify`;;
254-
Indicates whether people in the room should be
255-
actively notified. Defaults to `false`.
256-
257-
258209
[float]
259210
[[slack-notification-settings]]
260211
==== Slack Notification Settings

docs/reference/setup/important-settings/network-host.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The `network.host` setting also understands some special values such as
2323
`_local_`, `_site_`, `_global_` and modifiers like `:ip4` and `:ip6`, details of
2424
which can be found in <<network-interface-values>>.
2525

26-
IMPORTANT: As soon you provide a custom setting for `network.host`,
26+
IMPORTANT: As soon as you provide a custom setting for `network.host`,
2727
Elasticsearch assumes that you are moving from development mode to production
2828
mode, and upgrades a number of system startup checks from warnings to
2929
exceptions. See <<dev-vs-prod>> for more information.

0 commit comments

Comments
 (0)