Skip to content

Commit

Permalink
Fix time series timestamp meta missing (#80695)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weizijun authored Nov 22, 2021
1 parent bf57b74 commit 2136af2
Show file tree
Hide file tree
Showing 6 changed files with 651 additions and 304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ reject timestamp meta field with wrong type:
reason: introduced in 8.0.0 to be backported to 7.16.0

- do:
catch: /.* time series index \[_data_stream_timestamp\] meta field must be enabled/
catch: /\[_data_stream_timestamp\] meta field has been disabled/
indices.create:
index: test
body:
Expand Down
Loading

0 comments on commit 2136af2

Please sign in to comment.