-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Fix time series timestamp meta missing #80695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine, I'm trying to move these code into IndexMode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the code, is it ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me.
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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.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.