-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Allow Bucket Script aggregation to reference on string results #36642
Comments
Pinging @elastic/es-analytics-geo |
Right now, most of the pipeline aggs are geared towards doing numeric transformations (derivatives, etc), which is where that limitation is coming from. The BucketScript agg is definitely a little different, since you have access to a script. What sort of operation are you wanting to do with the strings? |
My case is a little specific: I have a query with dozens of aggregations. Some of them are really nested. Then, on application level we need to read elastic raw response (json) and marshal it to a struct. To simplify this thing we did a trick: For every metric that we need - we will have:
Why strings are needed? - Because some metrics can return not numeric result, but the value result .
|
I see, thanks for the detailed description! I think it makes sense to open up BucketScript for any kind of return value, not just numerics, given the open-ended nature of scripts. It will still need to support I think it would be a pretty straightforward change: modify the BucketScript painless context to return I'm going to label this |
Discussed this in the team meeting, and there was no objection to |
I'd like to work on this. |
👍 Note that #44179 will change BucketScript a little, and I'm working on a PR right now to add a I'm not sure how easy this enhancement will be. The pipeline framework is pretty much hardcoded to expect doubles everywhere right now. We may need to chip away at refactoring first before this ticket can be addressed. |
@polyfractal I think I'm stuck because of this feature request; I'm trying to count all specific fields based on an aggregation result. I posted here my Issue. Can you please take a look and let me know if there is any chance of doing what I need? |
@
I resolved this issue and here is the answer: https://stackoverflow.com/questions/60662222 |
Currently bucket script aggregations allows only numbers to be referenced on:
You will get:
"buckets_path must reference either a number value or a single value numeric metric aggregation, got: java.lang.String"
Result of the agg is just a string, not a list of object, or something complex. Why plain single strings are so offended that they can not be returned as a result?
The text was updated successfully, but these errors were encountered: