Skip to content

Commit 52921ee

Browse files
committed
Fix tests
1 parent 4d95872 commit 52921ee

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/logsdb/10_settings.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ override sort order settings:
276276
type: text
277277

278278
- match: { error.type: "illegal_argument_exception" }
279-
- match: { error.reason: "index.sort.fields:[] index.sort.order:[asc, asc], size mismatch" }
279+
- match: { error.reason: "setting [index.sort.order] requires [index.sort.field] to be configured" }
280280

281281
---
282282
override sort missing settings:
@@ -312,7 +312,7 @@ override sort missing settings:
312312
type: text
313313

314314
- match: { error.type: "illegal_argument_exception" }
315-
- match: { error.reason: "index.sort.fields:[] index.sort.missing:[_last, _first], size mismatch" }
315+
- match: { error.reason: "setting [index.sort.missing] requires [index.sort.field] to be configured" }
316316

317317
---
318318
override sort mode settings:
@@ -348,7 +348,7 @@ override sort mode settings:
348348
type: text
349349

350350
- match: { error.type: "illegal_argument_exception" }
351-
- match: { error.reason: "index.sort.fields:[] index.sort.mode:[MAX, MAX], size mismatch" }
351+
- match: { error.reason: "setting [index.sort.mode] requires [index.sort.field] to be configured" }
352352

353353
---
354354
override sort field using nested field type in sorting:

server/src/main/java/org/elasticsearch/index/IndexSortConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ public static FieldSortSpec[] getDefaultSortSpecs(Settings settings) {
192192
}
193193

194194
String indexMode = settings.get(IndexSettings.MODE.getKey());
195+
if (indexMode != null) {
196+
indexMode = indexMode.toLowerCase(Locale.ROOT);
197+
}
195198

196199
if (IndexMode.TIME_SERIES.getName().equals(indexMode)) {
197200
return TIME_SERIES_SORT;

server/src/test/java/org/elasticsearch/index/LogsIndexModeTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void testDefaultHostNameSortWithOrder() {
7474
.build()
7575
)
7676
);
77-
assertEquals("index.sort.fields:[] index.sort.order:[desc], size mismatch", exception.getMessage());
77+
assertEquals("setting [index.sort.order] requires [index.sort.field] to be configured", exception.getMessage());
7878
}
7979

8080
public void testDefaultHostNameSortWithMode() {
@@ -90,7 +90,7 @@ public void testDefaultHostNameSortWithMode() {
9090
.build()
9191
)
9292
);
93-
assertEquals("index.sort.fields:[] index.sort.mode:[MAX], size mismatch", exception.getMessage());
93+
assertEquals("setting [index.sort.mode] requires [index.sort.field] to be configured", exception.getMessage());
9494
}
9595

9696
public void testDefaultHostNameSortWithMissing() {
@@ -106,7 +106,7 @@ public void testDefaultHostNameSortWithMissing() {
106106
.build()
107107
)
108108
);
109-
assertEquals("index.sort.fields:[] index.sort.missing:[_first], size mismatch", exception.getMessage());
109+
assertEquals("setting [index.sort.missing] requires [index.sort.field] to be configured", exception.getMessage());
110110
}
111111

112112
public void testCustomSortField() {

x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/30_logsdb_default_mapping.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,8 +1099,7 @@ create logsdb data stream with custom empty sorting:
10991099
index: $backing_index
11001100

11011101
- match: { [email protected]: date }
1102-
- match: { .$backing_index.mappings.properties.host.properties.name.type: keyword }
1103-
- match: { .$backing_index.mappings.properties.host.properties.name.ignore_above: 1024 }
1102+
- match: { .$backing_index.mappings.properties.host: null }
11041103

11051104
---
11061105
create logsdb data stream with custom sorting on timestamp:

0 commit comments

Comments
 (0)