[8.0 Research] Expression Caching / User-defined Expressions #88790
Labels
Breaking Change
Feature:Canvas
Feature:ExpressionLanguage
Interpreter expression language (aka canvas pipeline)
R&D
Research and development ticket (not meant to produce code, but to make a decision)
Team:Presentation
Presentation Team for Dashboard, Input Controls, and Canvas
Summary of Exploration or Proposed Change
Problems to solve
Duplicate expressions-- or portions thereof-- are common in Canvas. This project has several parts:
Allowing someone to save any expression as a new, user-defined expression.
For example, given this expression:
someone could save portions as new expressions:
and then revise the original expression:
While we may be able to do this today with variables, providing users or solutions (e.g. Canvas) to manage global expressions would be ideal.
Caching Expressions and Expression Results
We've often discussed caching expressions and expression results. Canvas could find a way to cache duplicate expressions as workpad variables and/or Expressions could provide a means of doing this automatically. We should find the balance of effort and target 8.0 for either or some combination.
Dependencies or Impact
Findings
Caching Expressions and Expression Results
After discussion with expressions working group, it sounds like we'll want to handle caching at the search session level. I don't see caching on the search session roadmap so I'll need to follow-up and see if there's an issue for that already.
Moving to the search session service seems to be the right move, however, for a few reasons. First, moving to the search service (even without using a search session) will move us off of the legacy elasticsearch client which is important since it's being removed soon. Second, moving to search sessions could bring us some performance gains by restoring a session when we navigate to a workpad. This would mean we wouldn't necessarily have to reload a workpad every time the page is visited. I think we might have to wait until #85126 is implemented but I'll confirm and update at a later date. Finally, we could likely remove the data source functions (essql, esdocs, etc) from the server in their batched processing route. I'm getting confirmation on how it works exactly but it seems like calling the search service on the front-end applies a similar batching strategy. From what I understand, dashboard is already doing this and I think Canvas is a very similar use case.
There is a long issue on the history of Canvas querying on server vs client here: #29118 After reading through, the tl;dr seems to be that the functions were moved to the server with the batch route because 1. we needed to get off of web sockets and 2. elasticsearch-client was being deprecated. Using the search service, I don't think there will be any problems with running the expressions on the client. The requests are basically going to get batched in a similar way, Canvas just won't have to deal with.
This does NOT appear to be a 8.0 breaking change. (But will likely require enhancements/help from other teams)
Allowing someone to save any expression as a new, user-defined expression
I haven't had as much time as I would like to dive into this.
It seems like that this is something we'd want to move outside of just Canvas since other applications may want to eventually use expressions. Saved objects can already reference other saved objects so workpads could be given a new record in their schema that references used expressions.
This could also be an area of cooperation with the Lens folks since at some point they might be considering using user-defined expressions. We could have a really slick unified/shared experience for editing and/or viewing the expressions you want to use.
I think there are some tricky implementation details to still work out (like, I'd imagine you'd want to refer to the used-saved expression in an element expression but you need to likely keep track of the referenced user-saved expressions separately in the saved object structure so that the workpad could get exported properly with its referenced expressions) but since this would be a schema addition, I don't think this would be a breaking change for users.
This does NOT appear to be a 8.0 breaking change.
NEW: using web worker for searching
I haven't done any research here, personally. I checked search session roadmap but there's nothing about web workers. I'll need to follow up with that team
The text was updated successfully, but these errors were encountered: