-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix downsampling with disabled subobjects #138715
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
base: main
Are you sure you want to change the base?
Fix downsampling with disabled subobjects #138715
Conversation
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
|
Hi @gmarouli, I've created a changelog YAML for you. |
server/src/test/java/org/elasticsearch/action/admin/cluster/stats/MappingVisitorTests.java
Outdated
Show resolved
Hide resolved
| private static void copyMapping(Map<String, ?> sourceMapping, Map<String, Object> updatedMapping) { | ||
| for (String f : sourceMapping.keySet()) { | ||
| if (f.equals(PROPERTIES) == false && f.equals(MULTI_FIELDS) == false) { | ||
| updatedMapping.put(f, sourceMapping.get(f)); |
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.
This copies meta objects, correct? Let's cover in a test (if not already).
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.
Meta and other parameters such as scaling_factor etc.
| Map<String, Object> downsampledMapping = new HashMap<>(); | ||
| for (Map.Entry<String, Object> entry : sourceIndexMappings.entrySet()) { | ||
| if (entry.getKey().equals(PROPERTIES) == false) { | ||
| downsampledMapping.put(entry.getKey(), entry.getValue()); |
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.
Why do we need this? Maybe add a comment?
| ); | ||
|
|
||
| HashMap<String, Object> result = new HashMap<>(); | ||
| MappingVisitor.visitAndCopyMapping(expectedProperties, result, (ignored, source, dest) -> { |
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.
Shall we also add a test that creates random mappings and checks that the copied one is a clone of the source?
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.
Great idea!
…ats/MappingVisitorTests.java Co-authored-by: Kostas Krikellas <[email protected]>
|
Update: I am currently working on the ci failures. The problem is that we need to be able to distringuish and handle differently a multi field from a subobjects false field :) Working on it. |
The downsampling operation is editing the source mapping to replace gauge metrics with an aggregate type which contains the pre-aggregated data.
However, the process does not respect the disabled subobjects configured by parent fields, for example, a passthrough field and gets conflicts as it tried to reconstruct the updated mapping.
For example, the following valid mapping section:
gets converted to:
Which is not valid because the disabled subobjects is not set anymore.
This PR (re)proposes to use the visitor pattern to update the source mapping in place. Last time we proposed that there was a better solution; however, now we see that the original structure of the mapping is important for inherited properties.
Fixes: #138572