Skip to content

server side scripting #7547

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

Closed
awkysam opened this issue Sep 3, 2014 · 5 comments
Closed

server side scripting #7547

awkysam opened this issue Sep 3, 2014 · 5 comments
Labels

Comments

@awkysam
Copy link

awkysam commented Sep 3, 2014

how about adding server side scripting capability similar to the lines of stored proc in SQL which will make ES more powerful analytics engine and avoids distributing logic between server side client side

@dadoonet
Copy link
Member

dadoonet commented Sep 3, 2014

Are you talking about things like this: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_script_11

I think IMHO that we already have that for many aggregations.

Closing. Feel free to reopen and add more details about what you expect if needed.

@dadoonet dadoonet closed this as completed Sep 3, 2014
@awkysam
Copy link
Author

awkysam commented Sep 3, 2014

to put it in simple words stored procedure kind of feature where we can store aggregated values in variable and then do some complex logic over that.
Whatever I have seen in the examples it is row by row operation for each value like functions in traditional SQL (_value * .8 or log(_value)).

@dadoonet dadoonet reopened this Sep 3, 2014
@roytmana
Copy link

roytmana commented Sep 3, 2014

I think it may already being considered but I would like agg metrics to support expressions based on other metrics in the same bucket. Say I want to calculate special kind of average based on several sums and counts

If calculated metrics could refernce outside of their bucket to child buckets or parent ones it would be even mote powerful but will require 2 step processing I guess

@clintongormley
Copy link
Contributor

Given that documents are distributed, the only efficient way to execute document level scripts is "row by row". We provide a scripted metric aggregation, and will probably add a scripted bucket aggregation, plus #8110 will add post-agg manipulation.

We don't want to allow arbitrary script execution, especially scripts that could maintain state, as they could be very costly indeed. Whatever we add needs to work efficiently in a distributed system.

Unless you have suggestions for types of scripts, I think this ticket is already solved by the above. thanks

@markharwood
Copy link
Contributor

Scripted upserts also allow you to perform aggregation of multiple events (e.g. web accesses) into a single document that aggregates them based on a common key (e.g. a session ID). The scripts can include logic that derives attributes for this entity based on new data and existing data e.g. update a web session duration or flag if the user looks to be a bot (accessed robots.txt, downloads no CSS/images)
It is then possible to perform query-time aggregations on these higher-level entities and their attributes such as isBot or duration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants