Skip to content

Commit 2136af2

Browse files
authored
Fix time series timestamp meta missing (elastic#80695)
I find a time series timestamp meta missing case. here is the reproduce steps: 1. create a time_series index, and set the timestamp field some meta. 2. index a doc with a new field that is not in mappings, it will call mappings marge. 3. then the timestamp field meta is missing. the reason that meta is missing is when a new field comes, `MappingParser.parse` will build a new mapping with new fields. And merge the new mappings with exist mapping. the new mapping have no timestamp field, so it will auto add timestamp field, the timestamp is without user's meta info. And merge method build a new timestamp field to override the user's timestamp field. It cause the timestamp meta missing. I fixed the case, by move timestamp logic from MappingParser.parse to create index logic. And move the tests to a new IT test. I add a test to test case, TimeSeriesModeIT.testAddTimeStampMeta will fail in the pre-commit.
1 parent bf57b74 commit 2136af2

File tree

6 files changed

+651
-304
lines changed

6 files changed

+651
-304
lines changed

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/15_timestamp_mapping.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ reject timestamp meta field with wrong type:
164164
reason: introduced in 8.0.0 to be backported to 7.16.0
165165

166166
- do:
167-
catch: /.* time series index \[_data_stream_timestamp\] meta field must be enabled/
167+
catch: /\[_data_stream_timestamp\] meta field has been disabled/
168168
indices.create:
169169
index: test
170170
body:

0 commit comments

Comments
 (0)