Fix time series timestamp meta missing#80695
Conversation
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
|
@elasticmachine update branch |
|
For my own education I reproduced this: |
| assertThat(getMappingsResponse.getMappings().get(index).source().string(), equalTo(Strings.toString(expect))); | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
I'd tend to want to do these as yaml rest tests instead of ESIntegTestCase. The yaml tests are much more copy and paste-ish, we run them during rolling upgrade testing and during backwards compatibility testing.
I'm not sure that it's worth rewriting it now though.
There was a problem hiding this comment.
fine, I move the test from TimeSeriesModeTests to TimeSeriesModeIT, some tests are the same with yaml tests. Maybe later, we can remove these tests.
| for (Map<String, Object> mapping : mappings) { | ||
| List<Map<String, Object>> mergedMappings = new ArrayList<>(); | ||
| boolean isTimeSeriesMode = indexService.getIndexSettings().getMode() != null | ||
| && indexService.getIndexSettings().getMode() == IndexMode.TIME_SERIES; |
There was a problem hiding this comment.
I think IndexSettings.getMode can't be null - it'd default to STANDARD.
I think I'd prefer to move this merge helping code to IndexMode too, if we can. If every behavior change in different index modes is a method on IndexMode then folks reading it can scan it for the kinds of behavior that it influences. Hard checks for a particular mode like this make that much harder.
There was a problem hiding this comment.
fine, I'm trying to move these code into IndexMode
There was a problem hiding this comment.
I change the code, is it ok?
|
@elasticmachine, test this please |
|
@elasticmachine update branch |
|
@elasticmachine test this please |
|
@weizijun the errors in the build look related to your change. |
ok, I will fixed the tests |
|
@elasticmachine, test this please |
|
Thanks for your patience on this one @weizijun ! |
|
Thank you, @nik9000 , @martijnvg ! |
I find a time series timestamp meta missing case.
here is the reproduce steps:
the reason that meta is missing is when a new field comes,
MappingParser.parsewill 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.