Skip to content

Commit 0cc85b0

Browse files
committed
Merge remote-tracking branch 'elastic/master' into add-public-key-header
* elastic/master: Do not serialize basic license exp in x-pack info (elastic#30848) Change BWC version for VerifyRepositoryResponse (elastic#30796) [DOCS] Document index name limitations (elastic#30826) Harmonize include_defaults tests (elastic#30700) [TEST] Mute {p0=snapshot.get_repository/10_basic/Verify created repository} YAML test
2 parents 9b10323 + dcff63e commit 0cc85b0

File tree

6 files changed

+69
-44
lines changed

6 files changed

+69
-44
lines changed

docs/reference/indices/create-index.asciidoc

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
[[indices-create-index]]
22
== Create Index
33

4-
The create index API allows to instantiate an index. Elasticsearch
5-
provides support for multiple indices, including executing operations
6-
across several indices.
4+
The Create Index API is used to manually create an index in Elasticsearch. All documents in Elasticsearch
5+
are stored inside of one index or another.
6+
7+
The most basic command is the following:
8+
9+
[source,js]
10+
--------------------------------------------------
11+
PUT twitter
12+
--------------------------------------------------
13+
// CONSOLE
14+
15+
This create an index named `twitter` with all default setting.
16+
17+
[NOTE]
18+
.Index name limitations
19+
======================================================
20+
There are several limitations to what you can name your index. The complete list of limitations are:
21+
22+
- Lowercase only
23+
- Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, ` ` (space character), `,`, `#`
24+
- Indices prior to 7.0 could contain a colon (`:`), but that's been deprecated and won't be supported in 7.0+
25+
- Cannot start with `-`, `_`, `+`
26+
- Cannot be `.` or ``..`
27+
- Cannot be longer than 255 bytes (note it is bytes, so multi-byte characters will count towards the 255 limit faster)
28+
29+
======================================================
730

831
[float]
932
[[create-index-settings]]
1033
=== Index Settings
1134

1235
Each index created can have specific settings
13-
associated with it.
36+
associated with it, defined in the body:
1437

1538
[source,js]
1639
--------------------------------------------------
@@ -28,25 +51,6 @@ PUT twitter
2851
<1> Default for `number_of_shards` is 1
2952
<2> Default for `number_of_replicas` is 1 (ie one replica for each primary shard)
3053

31-
The above second curl example shows how an index called `twitter` can be
32-
created with specific settings for it using http://www.yaml.org[YAML].
33-
In this case, creating an index with 3 shards, each with 2 replicas. The
34-
index settings can also be defined with http://www.json.org[JSON]:
35-
36-
[source,js]
37-
--------------------------------------------------
38-
PUT twitter
39-
{
40-
"settings" : {
41-
"index" : {
42-
"number_of_shards" : 3,
43-
"number_of_replicas" : 2
44-
}
45-
}
46-
}
47-
--------------------------------------------------
48-
// CONSOLE
49-
5054
or more simplified
5155

5256
[source,js]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
setup:
3+
- do:
4+
indices.create:
5+
body:
6+
settings:
7+
index:
8+
number_of_shards: 1
9+
number_of_replicas: 1
10+
index: test-index
11+
---
12+
Test retrieval of default settings:
13+
- skip:
14+
version: " - 6.3.99"
15+
reason: include_defaults will not work in mixed-mode clusters containing nodes pre-6.4
16+
- do:
17+
indices.get_settings:
18+
flat_settings: true
19+
index: test-index
20+
- is_false:
21+
test-index.settings.index\.refresh_interval
22+
- do:
23+
indices.get_settings:
24+
include_defaults: true
25+
flat_settings: true
26+
index: test-index
27+
- match:
28+
test-index.defaults.index\.refresh_interval: "1s"

rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_settings/11_reset.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,3 @@ Test reset index settings:
2323
indices.get_settings:
2424
flat_settings: false
2525
- is_false: test-index.settings.index\.refresh_interval
26-
27-
# Disabled until https://github.com/elastic/elasticsearch/pull/29229 is back-ported
28-
# That PR changed the execution path of index settings default to be on the master
29-
# until the PR is back-ported the old master will not return default settings.
30-
#
31-
# - do:
32-
# indices.get_settings:
33-
# include_defaults: true
34-
# flat_settings: true
35-
# index: test-index
36-
# - match:
37-
# test-index.defaults.index\.refresh_interval: "1s"

rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.get_repository/10_basic.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ setup:
5151

5252
---
5353
"Verify created repository":
54+
- skip:
55+
version: "all"
56+
reason: AwaitsFix for https://github.com/elastic/elasticsearch/issues/30807
5457
- do:
5558
snapshot.verify_repository:
5659
repository: test_repo_get_2

server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public VerifyRepositoryResponse(ClusterName clusterName, DiscoveryNode[] nodes)
140140
@Override
141141
public void readFrom(StreamInput in) throws IOException {
142142
super.readFrom(in);
143-
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
143+
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
144144
this.nodes = in.readList(NodeView::new).stream().map(n -> n.convertToDiscoveryNode()).collect(Collectors.toList());
145145
} else {
146146
clusterName = new ClusterName(in);
@@ -151,7 +151,7 @@ public void readFrom(StreamInput in) throws IOException {
151151
@Override
152152
public void writeTo(StreamOutput out) throws IOException {
153153
super.writeTo(out);
154-
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
154+
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
155155
out.writeList(getNodes());
156156
} else {
157157
clusterName.writeTo(out);

x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ public License.Status getStatus() {
123123

124124
@Override
125125
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
126-
return builder.startObject()
127-
.field("uid", uid)
128-
.field("type", type)
129-
.field("mode", mode)
130-
.field("status", status.label())
131-
.timeField("expiry_date_in_millis", "expiry_date", expiryDate)
132-
.endObject();
126+
builder.startObject()
127+
.field("uid", uid)
128+
.field("type", type)
129+
.field("mode", mode)
130+
.field("status", status.label());
131+
if (expiryDate != LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS) {
132+
builder.timeField("expiry_date_in_millis", "expiry_date", expiryDate);
133+
}
134+
return builder.endObject();
133135
}
134136

135137
public void writeTo(StreamOutput out) throws IOException {

0 commit comments

Comments
 (0)