Skip to content

Commit 4ef22a6

Browse files
committed
Merge remote-tracking branch 'elastic/master' into animal-sniffer-vestiges
* elastic/master: [DOCS] Fixes broken link in auditing settings QA: Better seed nodes for rolling restart [DOCS] Moves ML content to stack-docs [DOCS] Clarifies recommendation for audit index output type (elastic#31146) Add nio-transport as option for http smoke tests (elastic#31162) QA: Set better node names on rolling restart tests Add support for ignore_unmapped to geo sort (elastic#31153)
2 parents dea7cea + 5dc9e87 commit 4ef22a6

File tree

51 files changed

+185
-1459
lines changed

Some content is hidden

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

51 files changed

+185
-1459
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ class ClusterConfiguration {
8787
* A closure to call which returns the unicast host to connect to for cluster formation.
8888
*
8989
* This allows multi node clusters, or a new cluster to connect to an existing cluster.
90-
* The closure takes two arguments, the NodeInfo for the first node in the cluster, and
91-
* an AntBuilder which may be used to wait on conditions before returning.
90+
* The closure takes three arguments, the NodeInfo for the first node in the cluster,
91+
* the NodeInfo for the node current being configured, an AntBuilder which may be used
92+
* to wait on conditions before returning.
9293
*/
9394
@Input
9495
Closure unicastTransportUri = { NodeInfo seedNode, NodeInfo node, AntBuilder ant ->

docs/reference/search/request/sort.asciidoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ GET /_search
288288
"pin.location" : [-70, 40],
289289
"order" : "asc",
290290
"unit" : "km",
291-
"mode" : "min",
292-
"distance_type" : "arc"
291+
"mode" : "min",
292+
"distance_type" : "arc",
293+
"ignore_unmapped": true
293294
}
294295
}
295296
],
@@ -317,6 +318,12 @@ GET /_search
317318

318319
The unit to use when computing sort values. The default is `m` (meters).
319320

321+
322+
`ignore_unmapped`::
323+
324+
Indicates if the unmapped field should be treated as a missing value. Setting it to `true` is equivalent to specifying
325+
an `unmapped_type` in the field sort. The default is `false` (unmapped field are causing the search to fail).
326+
320327
NOTE: geo distance sorting does not support configurable missing values: the
321328
distance will always be considered equal to +Infinity+ when a document does not
322329
have values for the field that is used for distance computation.

docs/reference/settings/audit-settings.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Controls how often to roll over to a new index: `hourly`, `daily`, `weekly`, or
8787
`xpack.security.audit.index.events.include`::
8888
Specifies the audit events to be indexed. The default value is
8989
`anonymous_access_denied, authentication_failed, realm_authentication_failed, access_granted, access_denied, tampered_request, connection_granted, connection_denied, run_as_granted, run_as_denied`.
90-
See {xpack-ref}/auditing.html#audit-event-types[Audit Entry Types] for the
90+
See {xpack-ref}/audit-event-types.html[Audit Entry Types] for the
9191
complete list.
9292

9393
`xpack.security.audit.index.events.exclude`::

modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,7 @@ public Netty4HttpServerTransport(Settings settings, NetworkService networkServic
202202
this.maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings);
203203
this.maxInitialLineLength = SETTING_HTTP_MAX_INITIAL_LINE_LENGTH.get(settings);
204204
this.pipeliningMaxEvents = SETTING_PIPELINING_MAX_EVENTS.get(settings);
205-
this.httpHandlingSettings = new HttpHandlingSettings(Math.toIntExact(maxContentLength.getBytes()),
206-
Math.toIntExact(maxChunkSize.getBytes()),
207-
Math.toIntExact(maxHeaderSize.getBytes()),
208-
Math.toIntExact(maxInitialLineLength.getBytes()),
209-
SETTING_HTTP_RESET_COOKIES.get(settings),
210-
SETTING_HTTP_COMPRESSION.get(settings),
211-
SETTING_HTTP_COMPRESSION_LEVEL.get(settings),
212-
SETTING_HTTP_DETAILED_ERRORS_ENABLED.get(settings),
213-
pipeliningMaxEvents);
205+
this.httpHandlingSettings = HttpHandlingSettings.fromSettings(settings);
214206

215207
this.maxCompositeBufferComponents = SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS.get(settings);
216208
this.workerCount = SETTING_HTTP_WORKER_COUNT.get(settings);
@@ -446,7 +438,7 @@ protected void initChannel(Channel ch) throws Exception {
446438
if (handlingSettings.isCompression()) {
447439
ch.pipeline().addLast("encoder_compress", new HttpContentCompressor(handlingSettings.getCompressionLevel()));
448440
}
449-
if (SETTING_CORS_ENABLED.get(transport.settings())) {
441+
if (handlingSettings.isCorsEnabled()) {
450442
ch.pipeline().addLast("cors", new Netty4CorsHandler(transport.getCorsConfig()));
451443
}
452444
ch.pipeline().addLast("pipelining", new Netty4HttpPipeliningHandler(transport.logger, transport.pipeliningMaxEvents));

plugins/transport-nio/src/main/java/org/elasticsearch/http/nio/NioHttpServerTransport.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,7 @@ public NioHttpServerTransport(Settings settings, NetworkService networkService,
137137
ByteSizeValue maxHeaderSize = SETTING_HTTP_MAX_HEADER_SIZE.get(settings);
138138
ByteSizeValue maxInitialLineLength = SETTING_HTTP_MAX_INITIAL_LINE_LENGTH.get(settings);
139139
int pipeliningMaxEvents = SETTING_PIPELINING_MAX_EVENTS.get(settings);
140-
this.httpHandlingSettings = new HttpHandlingSettings(Math.toIntExact(maxContentLength.getBytes()),
141-
Math.toIntExact(maxChunkSize.getBytes()),
142-
Math.toIntExact(maxHeaderSize.getBytes()),
143-
Math.toIntExact(maxInitialLineLength.getBytes()),
144-
SETTING_HTTP_RESET_COOKIES.get(settings),
145-
SETTING_HTTP_COMPRESSION.get(settings),
146-
SETTING_HTTP_COMPRESSION_LEVEL.get(settings),
147-
SETTING_HTTP_DETAILED_ERRORS_ENABLED.get(settings),
148-
pipeliningMaxEvents);
140+
this.httpHandlingSettings = HttpHandlingSettings.fromSettings(settings);;
149141
this.corsConfig = buildCorsConfig(settings);
150142

151143
this.tcpNoDelay = SETTING_HTTP_TCP_NO_DELAY.get(settings);

plugins/transport-nio/src/test/java/org/elasticsearch/http/nio/HttpReadWriteHandlerTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import java.util.List;
5757
import java.util.function.BiConsumer;
5858

59+
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ENABLED;
5960
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION;
6061
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL;
6162
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED;
@@ -94,7 +95,8 @@ public void setMocks() {
9495
SETTING_HTTP_COMPRESSION.getDefault(settings),
9596
SETTING_HTTP_COMPRESSION_LEVEL.getDefault(settings),
9697
SETTING_HTTP_DETAILED_ERRORS_ENABLED.getDefault(settings),
97-
SETTING_PIPELINING_MAX_EVENTS.getDefault(settings));
98+
SETTING_PIPELINING_MAX_EVENTS.getDefault(settings),
99+
SETTING_CORS_ENABLED.getDefault(settings));
98100
ThreadContext threadContext = new ThreadContext(settings);
99101
nioSocketChannel = mock(NioSocketChannel.class);
100102
handler = new HttpReadWriteHandler(nioSocketChannel, transport, httpHandlingSettings, NamedXContentRegistry.EMPTY,

qa/rolling-upgrade/build.gradle

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ for (Version version : bwcVersions.wireCompatible) {
8383
* just stopped's data directory. */
8484
dataDir = { nodeNumber -> oldClusterTest.nodes[stopNode].dataDir }
8585
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
86+
setting 'node.name', "upgraded-node-${stopNode}"
8687
}
8788
}
8889

8990
Task oneThirdUpgradedTest = tasks.create(name: "${baseName}#oneThirdUpgradedTest", type: RestIntegTestTask)
9091

91-
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner,
92-
0, { oldClusterTest.nodes.get(1).transportUri() })
92+
configureUpgradeCluster("oneThirdUpgradedTestCluster", oldClusterTestRunner, 0,
93+
// Use all running nodes as seed nodes so there is no race between pinging and the tests
94+
{ oldClusterTest.nodes.get(1).transportUri() + ',' + oldClusterTest.nodes.get(2).transportUri() })
9395

9496
Task oneThirdUpgradedTestRunner = tasks.getByName("${baseName}#oneThirdUpgradedTestRunner")
9597
oneThirdUpgradedTestRunner.configure {
@@ -100,8 +102,9 @@ for (Version version : bwcVersions.wireCompatible) {
100102

101103
Task twoThirdsUpgradedTest = tasks.create(name: "${baseName}#twoThirdsUpgradedTest", type: RestIntegTestTask)
102104

103-
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner,
104-
1, { oneThirdUpgradedTest.nodes.get(0).transportUri() })
105+
configureUpgradeCluster("twoThirdsUpgradedTestCluster", oneThirdUpgradedTestRunner, 1,
106+
// Use all running nodes as seed nodes so there is no race between pinging and the tests
107+
{ oldClusterTest.nodes.get(2).transportUri() + ',' + oneThirdUpgradedTest.nodes.get(0).transportUri() })
105108

106109
Task twoThirdsUpgradedTestRunner = tasks.getByName("${baseName}#twoThirdsUpgradedTestRunner")
107110
twoThirdsUpgradedTestRunner.configure {
@@ -112,8 +115,9 @@ for (Version version : bwcVersions.wireCompatible) {
112115

113116
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
114117

115-
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner,
116-
2, { twoThirdsUpgradedTest.nodes.get(0).transportUri() })
118+
configureUpgradeCluster("upgradedClusterTestCluster", twoThirdsUpgradedTestRunner, 2,
119+
// Use all running nodes as seed nodes so there is no race between pinging and the tests
120+
{ oneThirdUpgradedTest.nodes.get(0).transportUri() + ',' + twoThirdsUpgradedTest.nodes.get(0).transportUri() })
117121

118122
Task upgradedClusterTestRunner = tasks.getByName("${baseName}#upgradedClusterTestRunner")
119123
upgradedClusterTestRunner.configure {

qa/smoke-test-http/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ apply plugin: 'elasticsearch.test-with-dependencies'
2323

2424
dependencies {
2525
testCompile project(path: ':modules:transport-netty4', configuration: 'runtime') // for http
26+
testCompile project(path: ':plugins:transport-nio', configuration: 'runtime') // for http
2627
}
2728

2829
integTestRunner {

qa/smoke-test-http/src/test/java/org/elasticsearch/http/HttpSmokeTestCase.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.elasticsearch.transport.MockTcpTransportPlugin;
2626
import org.elasticsearch.transport.Netty4Plugin;
2727
import org.elasticsearch.transport.nio.MockNioTransportPlugin;
28+
import org.elasticsearch.transport.nio.NioTransportPlugin;
2829
import org.junit.BeforeClass;
2930

3031
import java.util.Arrays;
@@ -39,22 +40,33 @@ public abstract class HttpSmokeTestCase extends ESIntegTestCase {
3940
@SuppressWarnings("unchecked")
4041
@BeforeClass
4142
public static void setUpTransport() {
42-
nodeTransportTypeKey = getTypeKey(randomFrom(getTestTransportPlugin(), Netty4Plugin.class));
43-
nodeHttpTypeKey = getTypeKey(Netty4Plugin.class);
44-
clientTypeKey = getTypeKey(randomFrom(getTestTransportPlugin(), Netty4Plugin.class));
43+
nodeTransportTypeKey = getTypeKey(randomFrom(getTestTransportPlugin(), Netty4Plugin.class, NioTransportPlugin.class));
44+
nodeHttpTypeKey = getHttpTypeKey(randomFrom(Netty4Plugin.class, NioTransportPlugin.class));
45+
clientTypeKey = getTypeKey(randomFrom(getTestTransportPlugin(), Netty4Plugin.class, NioTransportPlugin.class));
4546
}
4647

4748
private static String getTypeKey(Class<? extends Plugin> clazz) {
4849
if (clazz.equals(MockTcpTransportPlugin.class)) {
4950
return MockTcpTransportPlugin.MOCK_TCP_TRANSPORT_NAME;
5051
} else if (clazz.equals(MockNioTransportPlugin.class)) {
5152
return MockNioTransportPlugin.MOCK_NIO_TRANSPORT_NAME;
53+
} else if (clazz.equals(NioTransportPlugin.class)) {
54+
return NioTransportPlugin.NIO_TRANSPORT_NAME;
5255
} else {
5356
assert clazz.equals(Netty4Plugin.class);
5457
return Netty4Plugin.NETTY_TRANSPORT_NAME;
5558
}
5659
}
5760

61+
private static String getHttpTypeKey(Class<? extends Plugin> clazz) {
62+
if (clazz.equals(NioTransportPlugin.class)) {
63+
return NioTransportPlugin.NIO_HTTP_TRANSPORT_NAME;
64+
} else {
65+
assert clazz.equals(Netty4Plugin.class);
66+
return Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME;
67+
}
68+
}
69+
5870
@Override
5971
protected boolean addMockHttpTransport() {
6072
return false; // enable http
@@ -70,12 +82,12 @@ protected Settings nodeSettings(int nodeOrdinal) {
7082

7183
@Override
7284
protected Collection<Class<? extends Plugin>> nodePlugins() {
73-
return Arrays.asList(getTestTransportPlugin(), Netty4Plugin.class);
85+
return Arrays.asList(getTestTransportPlugin(), Netty4Plugin.class, NioTransportPlugin.class);
7486
}
7587

7688
@Override
7789
protected Collection<Class<? extends Plugin>> transportClientPlugins() {
78-
return Arrays.asList(getTestTransportPlugin(), Netty4Plugin.class);
90+
return Arrays.asList(getTestTransportPlugin(), Netty4Plugin.class, NioTransportPlugin.class);
7991
}
8092

8193
@Override

server/src/main/java/org/elasticsearch/http/HttpHandlingSettings.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.elasticsearch.common.settings.Settings;
2323
import org.elasticsearch.common.unit.ByteSizeValue;
2424

25+
import static org.elasticsearch.http.HttpTransportSettings.SETTING_CORS_ENABLED;
2526
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION;
2627
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION_LEVEL;
2728
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_DETAILED_ERRORS_ENABLED;
@@ -47,7 +48,7 @@ public class HttpHandlingSettings {
4748

4849
public HttpHandlingSettings(int maxContentLength, int maxChunkSize, int maxHeaderSize, int maxInitialLineLength,
4950
boolean resetCookies, boolean compression, int compressionLevel, boolean detailedErrorsEnabled,
50-
int pipeliningMaxEvents) {
51+
int pipeliningMaxEvents, boolean corsEnabled) {
5152
this.maxContentLength = maxContentLength;
5253
this.maxChunkSize = maxChunkSize;
5354
this.maxHeaderSize = maxHeaderSize;
@@ -57,6 +58,7 @@ public HttpHandlingSettings(int maxContentLength, int maxChunkSize, int maxHeade
5758
this.compressionLevel = compressionLevel;
5859
this.detailedErrorsEnabled = detailedErrorsEnabled;
5960
this.pipeliningMaxEvents = pipeliningMaxEvents;
61+
this.corsEnabled = corsEnabled;
6062
}
6163

6264
public static HttpHandlingSettings fromSettings(Settings settings) {
@@ -68,7 +70,8 @@ public static HttpHandlingSettings fromSettings(Settings settings) {
6870
SETTING_HTTP_COMPRESSION.get(settings),
6971
SETTING_HTTP_COMPRESSION_LEVEL.get(settings),
7072
SETTING_HTTP_DETAILED_ERRORS_ENABLED.get(settings),
71-
SETTING_PIPELINING_MAX_EVENTS.get(settings));
73+
SETTING_PIPELINING_MAX_EVENTS.get(settings),
74+
SETTING_CORS_ENABLED.get(settings));
7275
}
7376

7477
public int getMaxContentLength() {

0 commit comments

Comments
 (0)