Skip to content

Commit 0bd1803

Browse files
author
tmgordeeva
authored
Error message for misconfigured TSDB index (#96956)
* Error message for misconfigured TSDB index TSDB indices should always have synthetic source. * Update docs/changelog/96956.yaml
1 parent 524ecc7 commit 0bd1803

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

docs/changelog/96956.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 96956
2+
summary: Error message for misconfigured TSDB index
3+
area: TSDB
4+
type: bug
5+
issues:
6+
- 96445

modules/aggregations/src/yamlRestTest/resources/rest-api-spec/test/aggregations/time_series.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,20 @@ setup:
236236
sum:
237237
sum:
238238
field: val
239+
---
240+
"Configure with no synthetic source":
241+
- skip:
242+
version: " - 8.8.99"
243+
reason: "Error message fix in 8.9"
244+
245+
- do:
246+
catch: '/Time series indices only support synthetic source./'
247+
indices.create:
248+
index: tsdb_error
249+
body:
250+
settings:
251+
mode: time_series
252+
routing_path: [key]
253+
mappings:
254+
_source:
255+
enabled: false

server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ private boolean isDefault() {
137137
@Override
138138
public SourceFieldMapper build() {
139139
if (enabled.getValue().explicit() && mode.get() != null) {
140-
throw new MapperParsingException("Cannot set both [mode] and [enabled] parameters");
140+
if (indexMode == IndexMode.TIME_SERIES) {
141+
throw new MapperParsingException("Time series indices only support synthetic source");
142+
} else {
143+
throw new MapperParsingException("Cannot set both [mode] and [enabled] parameters");
144+
}
141145
}
142146
if (isDefault()) {
143147
return indexMode == IndexMode.TIME_SERIES ? TSDB_DEFAULT : DEFAULT;

0 commit comments

Comments
 (0)