Closed eryabitskiy closed 7 years ago
@eryabitskiy this is something that I have been thinking about but requires a few outstanding issues to be resolved first. Specifically these are https://github.com/elasticsearch/elasticsearch/pull/8421 and https://github.com/elasticsearch/elasticsearch/issues/8434. These would allow us to specify much more powerful order paths and the getProperty method on the scripted metric aggregation could be used to retrieve arbitrary properties of the scripts results.
Hi there, I'm not sure if this is appropriate but I thought you may want to gauge interest. We're very keen to see this as well. Currently we end up doing a lot of sorting on oversized resultsets in Go, whereas being able to sort on scripted metrics would save us this hassle.
+1 This would be great if solved!
+1
+1
:+1: sort on scripted metrics aggregations would be a killer feature. In the meantime we're also doing client-side sorting on oversized results.
+1
+1
+1
+1
+1 Aside from the other use-cases mentioned here, this feature would give the Kibana product some major strength, particularly for rapid prototyping.
+1
+1
(hopping on the "+1 to this feature" bandwagon)
+1
+1
+1
+1
+1
+1
+1
+1
+1
Regarding the computation of weighted average I sent a pull request to extend the current avg aggregation in order to support this kind of average natively without scripted metric.
Here the issue created on github: https://github.com/elastic/elasticsearch/issues/15731
Here the pull request (only the first approach is implemented): https://github.com/elastic/elasticsearch/pull/15781
Regarding the support of the order clause for scripted metric I sent a pull request to support that.
+1
+1
+1
+1
+1
+1
+1
+1
Looking forward for this one...
+1
@elasticsearch-guys, Is there any chance to integrate quickly my pull request or an improvement of it.
+1
+1
+1
+1
I realy need this feature please add it :) +1
+1 It would be a great feature
+1
+1
+1
Is there any other approach to this other than client side sorting at present? Trying to sort on a user -specified weighted average on the fly.
+1, (and a pretty please) 😄
+1
+1
+1
+1
Since there is a new Scripted metric aggregation (scripted_metric) in 1.4, it is possible to do a lot of amazing stuff. For example it is possible to implement Weighted Average aggregation, which we were missing before.
Now we are really missing a possibility to sort by scripted_metric results.
Live example:
We calculate weightedAvgVis with scripted_metric and want to get ids with TOP 5 values of weightedAvgVis. Since script returns double, it looks logically possible.