Skip to content

Commit 3abdab8

Browse files
committed
Merge remote-tracking branch 'elastic/master' into license-to-autoscale
* elastic/master: (33 commits) Add searchable snapshot cache folder to NodeEnvironment (elastic#66297) [DOCS] Add dynamic runtime fields to docs (elastic#66194) Add HDFS searchable snapshot integration (elastic#66185) Support canceling cross-clusters search requests (elastic#66206) Mute testCacheSurviveRestart (elastic#66289) Fix cat tasks api params in spec and handler (elastic#66272) Snapshot of a searchable snapshot should be empty (elastic#66162) [ML] DFA _explain API should not fail when none field is included (elastic#66281) Add action to decommission legacy monitoring cluster alerts (elastic#64373) move rollup_index param out of RollupActionConfig (elastic#66139) Improve FieldFetcher retrieval of fields (elastic#66160) Remove unsed fields in `RestAnalyzeAction` (elastic#66215) Simplify searchable snapshot CacheKey (elastic#66263) Autoscaling remove feature flags (elastic#65973) Improve searchable snapshot mount time (elastic#66198) [ML] Report cause when datafeed extraction encounters error (elastic#66167) Remove suggest reference in some API specs (elastic#66180) Fix warning when installing a plugin for different ESversion (elastic#66146) [ML] make `xpack.ml.max_ml_node_size` and `xpack.ml.use_auto_machine_memory_percent` dynamically settable (elastic#66132) [DOCS] Add `require_alias` to Bulk API (elastic#66259) ...
2 parents 6ea54e0 + 6ff54c0 commit 3abdab8

File tree

567 files changed

+5721
-1228
lines changed

Some content is hidden

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

567 files changed

+5721
-1228
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ indent_size = 2
1313

1414
[*.groovy]
1515
indent_size = 4
16+
max_line_length = 140
1617

1718
[*.java]
1819
indent_size = 4
20+
max_line_length = 140
1921

2022
[*.json]
2123
indent_size = 2

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,47 @@ You can import the Elasticsearch project into IntelliJ IDEA via:
164164
- In the subsequent dialog navigate to the root `build.gradle` file
165165
- In the subsequent dialog select **Open as Project**
166166

167+
#### Checkstyle
168+
169+
If you have the [Checkstyle] plugin installed, you can configure IntelliJ to
170+
check the Elasticsearch code. However, the Checkstyle configuration file does
171+
not work by default with the IntelliJ plugin, so instead an IDE-specific config
172+
file is generated automatically after IntelliJ finishes syncing.
173+
174+
1. Open **Preferences > Tools > Checkstyle**
175+
2. Change the "Scan Scope" to "Only Java sources (including tests)"
176+
3. Check the "+" under "Configuration file"
177+
4. Set "Description" to "Elasticsearch" (or whatever you want)
178+
5. Select "Use a local Checkstyle file"
179+
6. For the "File", navigate to `build/checkstyle_ide.xml`
180+
7. Tick "Store relative to project location"
181+
8. Click "Next"
182+
9. The Checkstyle config file contains the variable `config_loc`, and
183+
IntelliJ will ask for a value. Fill in `buildSrc/src/main/resources`.
184+
This allows the config file to reference the exclusions file in that directory.
185+
10. Click "Next", then "Finish".
186+
11. Click the box next to the new configuration to make it "Active". Without doing this,
187+
you'll have to explicitly choose the "Elasticsearch" configuration in the Checkstyle
188+
tool window and run the check manually. You can still do this with an active config.
189+
12. Click "OK" to apply the new preferences
190+
191+
#### Formatting
192+
193+
We are in the process of migrating towards automatic formatting Java file
194+
using [spotless], backed by the Eclipse formatter. If you have the [Eclipse
195+
Code Formatter] installed, you can apply formatting directly in IntelliJ.
196+
197+
1. Open **Preferences > Other Settings > Eclipse Code Formatter**
198+
2. Click "Use the Eclipse Code Formatter"
199+
3. Under "Eclipse formatter config", select "Eclipse workspace/project
200+
folder or config file"
201+
4. Click "Browse", and navigate to the file `buildSrc/formatterConfig.xml`
202+
5. Click "OK"
203+
204+
Note that only some sub-projects in the Elasticsearch project are currently
205+
fully-formatted. You can see a list of project that **are not**
206+
automatically formatted in [gradle/formatting.gradle](gradle/formatting.gradle).
207+
167208
### Importing the project into Eclipse
168209

169210
Elasticsearch builds using Gradle and Java 14. When importing into Eclipse you
@@ -699,3 +740,6 @@ non-documentation contribution. This is mentioned above, but it is worth
699740
repeating in this section because it has come up in this context.
700741

701742
[intellij]: https://blog.jetbrains.com/idea/2017/07/intellij-idea-2017-2-is-here-smart-sleek-and-snappy/
743+
[Checkstyle]: https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
744+
[spotless]: https://github.com/diffplug/spotless
745+
[Eclipse Code Formatter]: https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter

client/rest-high-level/src/main/java/org/elasticsearch/client/ml/job/config/CategorizationAnalyzerConfig.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.elasticsearch.client.ml.job.config;
2020

21+
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
2122
import org.elasticsearch.common.ParseField;
2223
import org.elasticsearch.common.settings.Settings;
2324
import org.elasticsearch.common.xcontent.ToXContentFragment;
@@ -59,9 +60,9 @@
5960
public class CategorizationAnalyzerConfig implements ToXContentFragment {
6061

6162
public static final ParseField CATEGORIZATION_ANALYZER = new ParseField("categorization_analyzer");
62-
private static final ParseField TOKENIZER = RestAnalyzeAction.Fields.TOKENIZER;
63-
private static final ParseField TOKEN_FILTERS = RestAnalyzeAction.Fields.TOKEN_FILTERS;
64-
private static final ParseField CHAR_FILTERS = RestAnalyzeAction.Fields.CHAR_FILTERS;
63+
private static final ParseField TOKENIZER = AnalyzeAction.Fields.TOKENIZER;
64+
private static final ParseField TOKEN_FILTERS = AnalyzeAction.Fields.TOKEN_FILTERS;
65+
private static final ParseField CHAR_FILTERS = AnalyzeAction.Fields.CHAR_FILTERS;
6566

6667
/**
6768
* This method is only used in the unit tests - in production code this config is always parsed as a fragment.

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/ListPluginsCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private void printPlugin(Environment env, Terminal terminal, Path plugin, String
7070
"WARNING: plugin ["
7171
+ info.getName()
7272
+ "] was built for Elasticsearch version "
73-
+ info.getVersion()
73+
+ info.getElasticsearchVersion()
7474
+ " but version "
7575
+ Version.CURRENT
7676
+ " is required"

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void testExistingIncompatiblePlugin() throws Exception {
266266
buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2");
267267

268268
MockTerminal terminal = listPlugins(home);
269-
String message = "plugin [fake_plugin1] was built for Elasticsearch version 1.0 but version " + Version.CURRENT + " is required";
269+
String message = "plugin [fake_plugin1] was built for Elasticsearch version 1.0.0 but version " + Version.CURRENT + " is required";
270270
assertEquals("fake_plugin1\nfake_plugin2\n", terminal.getOutput());
271271
assertEquals("WARNING: " + message + "\n", terminal.getErrorOutput());
272272

docs/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ testClusters.matching { it.name == "integTest"}.configureEach {
5454
if (singleNode().testDistribution == DEFAULT) {
5555
setting 'xpack.license.self_generated.type', 'trial'
5656
setting 'indices.lifecycle.history_index_enabled', 'false'
57-
if (BuildParams.isSnapshotBuild() == false) {
58-
systemProperty 'es.autoscaling_feature_flag_registered', 'true'
59-
}
60-
setting 'xpack.autoscaling.enabled', 'true'
6157
systemProperty 'es.rollup_v2_feature_flag_enabled', 'true'
6258
keystorePassword 's3cr3t'
6359
}

docs/reference/autoscaling/apis/autoscaling-apis.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
[[autoscaling-apis]]
44
== Autoscaling APIs
55

6+
experimental[]
7+
68
You can use the following APIs to perform autoscaling operations.
79

810
[discrete]

docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<titleabbrev>Delete autoscaling policy</titleabbrev>
77
++++
88

9+
experimental[]
10+
911
Delete autoscaling policy.
1012

1113
[[autoscaling-delete-autoscaling-policy-request]]

docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<titleabbrev>Get autoscaling capacity</titleabbrev>
77
++++
88

9+
experimental[]
10+
911
Get autoscaling capacity.
1012

1113
[[autoscaling-get-autoscaling-capacity-request]]

docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<titleabbrev>Get autoscaling policy</titleabbrev>
77
++++
88

9+
experimental[]
10+
911
Get autoscaling policy.
1012

1113
[[autoscaling-get-autoscaling-policy-request]]

docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<titleabbrev>Put autoscaling policy</titleabbrev>
77
++++
88

9+
experimental[]
10+
911
Put autoscaling policy.
1012

1113
[[autoscaling-put-autoscaling-policy-request]]

docs/reference/docs/bulk.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=pipeline]
211211

212212
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=refresh]
213213

214+
`require_alias`::
215+
(Optional, Boolean)
216+
If `true`, the request's actions must target an <<indices-aliases,index alias>>.
217+
Defaults to `false`.
218+
214219
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=routing]
215220

216221
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=source]
@@ -237,6 +242,8 @@ The following line must contain the source data to be indexed.
237242
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-index]
238243

239244
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-id]
245+
246+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-require-alias]
240247
--
241248

242249
`delete`::
@@ -249,6 +256,8 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-index]
249256
`_id`::
250257
(Required, string)
251258
The document ID.
259+
260+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-require-alias]
252261
--
253262

254263
`index`::
@@ -261,6 +270,8 @@ The following line must contain the source data to be indexed.
261270
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-index]
262271

263272
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-id]
273+
274+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-require-alias]
264275
--
265276

266277
`update`::
@@ -272,6 +283,8 @@ The following line must contain the partial document and update options.
272283
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-index]
273284

274285
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-id]
286+
287+
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bulk-require-alias]
275288
--
276289

277290
`doc`::

docs/reference/docs/data-replication.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ is as follows:
108108
. Resolve the read requests to the relevant shards. Note that since most searches will be sent to one or more indices,
109109
they typically need to read from multiple shards, each representing a different subset of the data.
110110
. Select an active copy of each relevant shard, from the shard replication group. This can be either the primary or
111-
a replica. By default, Elasticsearch will simply round robin between the shard copies.
111+
a replica. By default, {es} uses <<search-adaptive-replica,adaptive replica
112+
selection>> to select the shard copies.
112113
. Send shard level read requests to the selected copies.
113114
. Combine the results and respond. Note that in the case of get by ID look up, only one shard is relevant and this step can be skipped.
114115

docs/reference/index.asciidoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@ include::data-management.asciidoc[]
4848

4949
include::ilm/index.asciidoc[]
5050

51-
ifdef::permanently-unreleased-branch[]
52-
5351
include::autoscaling/index.asciidoc[]
5452

55-
endif::[]
56-
5753
include::monitoring/index.asciidoc[]
5854

5955
include::frozen-indices.asciidoc[]

docs/reference/mapping/dynamic/field-mapping.asciidoc

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
[[dynamic-field-mapping]]
22
=== Dynamic field mapping
33

4-
By default, when a previously unseen field is found in a document,
5-
Elasticsearch will add the new field to the type mapping. This behaviour can
6-
be disabled, both at the document and at the <<object,`object`>> level, by
7-
setting the <<dynamic,`dynamic`>> parameter to `false` (to ignore new fields) or to `strict` (to throw
8-
an exception if an unknown field is encountered).
9-
10-
Assuming `dynamic` field mapping is enabled, some simple rules are used to
11-
determine which data type the field should have:
12-
13-
[horizontal]
14-
*JSON data type*:: *Elasticsearch data type*
15-
16-
`null`:: No field is added.
17-
`true` or `false`:: <<boolean,`boolean`>> field
18-
floating{nbsp}point{nbsp}number:: <<number,`float`>> field
19-
integer:: <<number,`long`>> field
20-
object:: <<object,`object`>> field
21-
array:: Depends on the first non-`null` value in the array.
22-
string:: Either a <<date,`date`>> field
23-
(if the value passes <<date-detection,date detection>>),
24-
a <<number,`double`>> or <<number,`long`>> field
25-
(if the value passes <<numeric-detection,numeric detection>>)
26-
or a <<text,`text`>> field, with a <<keyword,`keyword`>> sub-field.
27-
28-
These are the only <<mapping-types,field data types>> that are dynamically
29-
detected. All other data types must be mapped explicitly.
30-
31-
Besides the options listed below, dynamic field mapping rules can be further
32-
customised with <<dynamic-templates,`dynamic_templates`>>.
4+
When {es} detects a new field in a document, it _dynamically_ adds the field to
5+
the type mapping. The <<dynamic,`dynamic`>> parameter controls this behavior.
6+
7+
You can disable dynamic mapping, both at the document and at the
8+
<<object,`object`>> level. Setting the `dynamic` parameter to
9+
`false` ignores new fields, and `strict` rejects the document if {es}
10+
encounters an unknown field.
11+
12+
When dynamic field mapping is enabled, {es} uses the following rules to
13+
determine how to map data types for each field.
14+
15+
NOTE: These are the only <<mapping-types,field data types>> that {es} detects
16+
dynamically. All other data types must be mapped explicitly.
17+
18+
[cols="3"]
19+
|===
20+
h| JSON data type h| `dynamic:true` h| `dynamic:runtime`
21+
|`null` 2*| No field added
22+
|`true` or `false` 2*| `boolean`
23+
|floating point number | `float` | `double`
24+
|`integer` 2*| `long`
25+
|`object`<<dynamic-object-footnote,^1^>> 2*| `object`
26+
|`array` 2*| Depends on the first non-`null` value in the array
27+
|`string` that passes <<date-detection,date detection>> 2*| `date`
28+
|`string` that passes <<numeric-detection,numeric detection>> | `double` or `long` | `double`
29+
|`string` that doesn't pass `date` detection or `numeric` detection | `text` with a `.keyword` sub-field | `keyword`
30+
3+| [[dynamic-object-footnote]] ^1^Objects are always mapped as part of the `properties` section, even when the `dynamic` parameter is set to `runtime`. | |
31+
|===
32+
33+
Besides the following options, you can customize dynamic field mapping rules
34+
with <<dynamic-templates,`dynamic_templates`>>.
3335

3436
[[date-detection]]
3537
==== Date detection
@@ -129,4 +131,3 @@ PUT my-index-000001/_doc/1
129131

130132
<1> The `my_float` field is added as a <<number,`float`>> field.
131133
<2> The `my_integer` field is added as a <<number,`long`>> field.
132-

0 commit comments

Comments
 (0)