Skip to content

Commit ffd226e

Browse files
committed
Add // NOTCONSOLE to docs
We have 1074 snippets that look like they should be converted to `// CONSOLE`. At least that is what `gradle docs:listConsoleCandidates` says. This adds `// NOTCONSOLE` to explicitly mark snippets that *shouldn't* be converted to `// CONSOLE`. After marking the blindingly obvious ones this cuts the remaining snippet count to 1032.
1 parent f832eaa commit ffd226e

23 files changed

+73
-19
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class DocsTestPlugin extends RestTestPlugin {
4242
'List snippets that probably should be marked // CONSOLE'
4343
listConsoleCandidates.perSnippet {
4444
if (
45-
it.console // Already marked, nothing to do
46-
|| it.testResponse // It is a response
45+
it.console != null // Already marked, nothing to do
46+
|| it.testResponse // It is a response
4747
) {
4848
return
4949
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/SnippetsTask.groovy

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,38 @@ public class SnippetsTask extends DefaultTask {
114114
return
115115
}
116116
if (line ==~ /\/\/\s*AUTOSENSE\s*/) {
117-
throw new InvalidUserDataException("AUTOSENSE has been " +
118-
"replaced by CONSOLE. Use that instead at " +
119-
"$file:$lineNumber")
117+
throw new InvalidUserDataException("$file:$lineNumber: "
118+
+ "AUTOSENSE has been replaced by CONSOLE.")
120119
}
121120
if (line ==~ /\/\/\s*CONSOLE\s*/) {
122121
if (snippet == null) {
123-
throw new InvalidUserDataException("CONSOLE not " +
124-
"paired with a snippet at $file:$lineNumber")
122+
throw new InvalidUserDataException("$file:$lineNumber: "
123+
+ "CONSOLE not paired with a snippet")
124+
}
125+
if (snippet.console != null) {
126+
throw new InvalidUserDataException("$file:$lineNumber: "
127+
+ "Can't be both CONSOLE and NOTCONSOLE")
125128
}
126129
snippet.console = true
127130
return
128131
}
132+
if (line ==~ /\/\/\s*NOTCONSOLE\s*/) {
133+
if (snippet == null) {
134+
throw new InvalidUserDataException("$file:$lineNumber: "
135+
+ "NOTCONSOLE not paired with a snippet")
136+
}
137+
if (snippet.console != null) {
138+
throw new InvalidUserDataException("$file:$lineNumber: "
139+
+ "Can't be both CONSOLE and NOTCONSOLE")
140+
}
141+
snippet.console = false
142+
return
143+
}
129144
matcher = line =~ /\/\/\s*TEST(\[(.+)\])?\s*/
130145
if (matcher.matches()) {
131146
if (snippet == null) {
132-
throw new InvalidUserDataException("TEST not " +
133-
"paired with a snippet at $file:$lineNumber")
147+
throw new InvalidUserDataException("$file:$lineNumber: "
148+
+ "TEST not paired with a snippet at ")
134149
}
135150
snippet.test = true
136151
if (matcher.group(2) != null) {
@@ -172,8 +187,8 @@ public class SnippetsTask extends DefaultTask {
172187
matcher = line =~ /\/\/\s*TESTRESPONSE(\[(.+)\])?\s*/
173188
if (matcher.matches()) {
174189
if (snippet == null) {
175-
throw new InvalidUserDataException("TESTRESPONSE not " +
176-
"paired with a snippet at $file:$lineNumber")
190+
throw new InvalidUserDataException("$file:$lineNumber: "
191+
+ "TESTRESPONSE not paired with a snippet")
177192
}
178193
snippet.testResponse = true
179194
if (matcher.group(2) != null) {
@@ -226,7 +241,7 @@ public class SnippetsTask extends DefaultTask {
226241
int end = NOT_FINISHED
227242
String contents
228243

229-
boolean console = false
244+
Boolean console = null
230245
boolean test = false
231246
boolean testResponse = false
232247
boolean testSetup = false
@@ -243,8 +258,8 @@ public class SnippetsTask extends DefaultTask {
243258
if (language != null) {
244259
result += "($language)"
245260
}
246-
if (console) {
247-
result += '// CONSOLE'
261+
if (console != null) {
262+
result += console ? '// CONSOLE' : '// NOTCONSOLE'
248263
}
249264
if (test) {
250265
result += '// TEST'

docs/plugins/analysis-icu.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This plugin can be installed using the plugin manager:
1717
----------------------------------------------------------------
1818
sudo bin/elasticsearch-plugin install analysis-icu
1919
----------------------------------------------------------------
20+
// NOTCONSOLE
2021

2122
The plugin must be installed on every node in the cluster, and each node must
2223
be restarted after installation.
@@ -31,6 +32,7 @@ The plugin can be removed with the following command:
3132
----------------------------------------------------------------
3233
sudo bin/elasticsearch-plugin remove analysis-icu
3334
----------------------------------------------------------------
35+
// NOTCONSOLE
3436

3537
The node must be stopped before removing the plugin.
3638

docs/plugins/analysis-kuromoji.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This plugin can be installed using the plugin manager:
1414
----------------------------------------------------------------
1515
sudo bin/elasticsearch-plugin install analysis-kuromoji
1616
----------------------------------------------------------------
17+
// NOTCONSOLE
1718

1819
The plugin must be installed on every node in the cluster, and each node must
1920
be restarted after installation.
@@ -28,6 +29,7 @@ The plugin can be removed with the following command:
2829
----------------------------------------------------------------
2930
sudo bin/elasticsearch-plugin remove analysis-kuromoji
3031
----------------------------------------------------------------
32+
// NOTCONSOLE
3133

3234
The node must be stopped before removing the plugin.
3335

docs/plugins/analysis-phonetic.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This plugin can be installed using the plugin manager:
1515
----------------------------------------------------------------
1616
sudo bin/elasticsearch-plugin install analysis-phonetic
1717
----------------------------------------------------------------
18+
// NOTCONSOLE
1819

1920
The plugin must be installed on every node in the cluster, and each node must
2021
be restarted after installation.
@@ -29,6 +30,7 @@ The plugin can be removed with the following command:
2930
----------------------------------------------------------------
3031
sudo bin/elasticsearch-plugin remove analysis-phonetic
3132
----------------------------------------------------------------
33+
// NOTCONSOLE
3234

3335
The node must be stopped before removing the plugin.
3436

docs/plugins/analysis-smartcn.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This plugin can be installed using the plugin manager:
2020
----------------------------------------------------------------
2121
sudo bin/elasticsearch-plugin install analysis-smartcn
2222
----------------------------------------------------------------
23+
// NOTCONSOLE
2324

2425
The plugin must be installed on every node in the cluster, and each node must
2526
be restarted after installation.
@@ -34,6 +35,7 @@ The plugin can be removed with the following command:
3435
----------------------------------------------------------------
3536
sudo bin/elasticsearch-plugin remove analysis-smartcn
3637
----------------------------------------------------------------
38+
// NOTCONSOLE
3739

3840
The node must be stopped before removing the plugin.
3941

@@ -45,4 +47,3 @@ The plugin provides the `smartcn` analyzer and `smartcn_tokenizer` tokenizer,
4547
which are not configurable.
4648

4749
NOTE: The `smartcn_word` token filter and `smartcn_sentence` have been deprecated.
48-

docs/plugins/analysis-stempel.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This plugin can be installed using the plugin manager:
1717
----------------------------------------------------------------
1818
sudo bin/elasticsearch-plugin install analysis-stempel
1919
----------------------------------------------------------------
20+
// NOTCONSOLE
2021

2122
The plugin must be installed on every node in the cluster, and each node must
2223
be restarted after installation.
@@ -31,6 +32,7 @@ The plugin can be removed with the following command:
3132
----------------------------------------------------------------
3233
sudo bin/elasticsearch-plugin remove analysis-stempel
3334
----------------------------------------------------------------
35+
// NOTCONSOLE
3436

3537
The node must be stopped before removing the plugin.
3638

@@ -40,4 +42,3 @@ The node must be stopped before removing the plugin.
4042

4143
The plugin provides the `polish` analyzer and `polish_stem` token filter,
4244
which are not configurable.
43-

docs/plugins/discovery-azure-classic.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This plugin can be installed using the plugin manager:
1717
----------------------------------------------------------------
1818
sudo bin/elasticsearch-plugin install discovery-azure-classic
1919
----------------------------------------------------------------
20+
// NOTCONSOLE
2021

2122
The plugin must be installed on every node in the cluster, and each node must
2223
be restarted after installation.
@@ -31,6 +32,7 @@ The plugin can be removed with the following command:
3132
----------------------------------------------------------------
3233
sudo bin/elasticsearch-plugin remove discovery-azure-classic
3334
----------------------------------------------------------------
35+
// NOTCONSOLE
3436

3537
The node must be stopped before removing the plugin.
3638

docs/plugins/discovery-ec2.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This plugin can be installed using the plugin manager:
1313
----------------------------------------------------------------
1414
sudo bin/elasticsearch-plugin install discovery-ec2
1515
----------------------------------------------------------------
16+
// NOTCONSOLE
1617

1718
The plugin must be installed on every node in the cluster, and each node must
1819
be restarted after installation.
@@ -27,6 +28,7 @@ The plugin can be removed with the following command:
2728
----------------------------------------------------------------
2829
sudo bin/elasticsearch-plugin remove discovery-ec2
2930
----------------------------------------------------------------
31+
// NOTCONSOLE
3032

3133
The node must be stopped before removing the plugin.
3234

@@ -140,7 +142,7 @@ discovery:
140142
You must also set `cloud.aws.region` if you are not using default AWS region. See <<discovery-ec2-usage-region>> for details.
141143

142144
The ec2 discovery is using the same credentials as the rest of the AWS services provided by this plugin (`repositories`).
143-
See <<discovery-ec2-usage>> for details.
145+
See <<discovery-ec2-usage>> for details.
144146

145147
The following are a list of settings (prefixed with `discovery.ec2`) that can further control the discovery:
146148

@@ -267,7 +269,7 @@ When selecting disk please be aware of the following order of preference:
267269
* http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html[Instance Store] - When running clusters of larger size and with replicas the ephemeral nature of Instance Store is ideal since Elasticsearch can tolerate the loss of shards. With Instance Store one gets the performance benefit of having disk physically attached to the host running the instance and also the cost benefit of avoiding paying extra for EBS.
268270

269271

270-
Prefer https://aws.amazon.com/amazon-linux-ami/[Amazon Linux AMIs] as since Elasticsearch runs on the JVM, OS dependencies are very minimal and one can benefit from the lightweight nature, support, and performance tweaks specific to EC2 that the Amazon Linux AMIs offer.
272+
Prefer https://aws.amazon.com/amazon-linux-ami/[Amazon Linux AMIs] as since Elasticsearch runs on the JVM, OS dependencies are very minimal and one can benefit from the lightweight nature, support, and performance tweaks specific to EC2 that the Amazon Linux AMIs offer.
271273

272274
===== Networking
273275
* Networking throttling takes place on smaller instance types in both the form of https://lab.getbase.com/how-we-discovered-limitations-on-the-aws-tcp-stack/[bandwidth and number of connections]. Therefore if large number of connections are needed and networking is becoming a bottleneck, avoid https://aws.amazon.com/ec2/instance-types/[instance types] with networking labeled as `Moderate` or `Low`.

docs/plugins/discovery-gce.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This plugin can be installed using the plugin manager:
1313
----------------------------------------------------------------
1414
sudo bin/elasticsearch-plugin install discovery-gce
1515
----------------------------------------------------------------
16+
// NOTCONSOLE
1617

1718
The plugin must be installed on every node in the cluster, and each node must
1819
be restarted after installation.
@@ -27,6 +28,7 @@ The plugin can be removed with the following command:
2728
----------------------------------------------------------------
2829
sudo bin/elasticsearch-plugin remove discovery-gce
2930
----------------------------------------------------------------
31+
// NOTCONSOLE
3032

3133
The node must be stopped before removing the plugin.
3234

0 commit comments

Comments
 (0)