Clean up top_metric's internal API#71738
Merged
nik9000 merged 6 commits intoelastic:masterfrom Apr 19, 2021
Merged
Conversation
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
nik9000
commented
Apr 15, 2021
| return null; | ||
| } | ||
| return metric.numberValue(); | ||
| return metric.getValue().getKey(); |
Member
Author
There was a problem hiding this comment.
This'll return a BytesRef if you fetch from a keyword or ip or bytes field. Would it be more useful to you if I formatted it? Or do you want the raw bytes?
There was a problem hiding this comment.
In my local version I have a valueAsString method, I don't think I need this interface.
I will ping you on my PR once I have it ready.
Collaborator
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
nik9000
added a commit
to nik9000/elasticsearch
that referenced
this pull request
Apr 19, 2021
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
nik9000
added a commit
that referenced
this pull request
Apr 20, 2021
This changes `top_metrics`'s implementation of `getProperty` and `value` to be a bit more consisntent which shold make it easier to integrate into transform. We expect `value` to return `NaN` when the value isn't a number or is null but was throwing exceptions in both that cases. `getProperty` was throwing exceptions on null and non-numeric values as well. Now it returns `null` or `BytesRef`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes
top_metrics's implementation ofgetPropertyandvalueto be a bit more consisntent which shold make it easier to integrate
into transform. We expect
valueto returnNaNwhen the value isn't anumber or is null but was throwing exceptions in both that cases.
getPropertywas throwing exceptions on null and non-numeric values aswell. Now it returns
nullorBytesRef.