-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Kibana] creating new fields on the fly (Lens, Discover etc..) #33800
Comments
Pinging @elastic/kibana-app |
I can see this functionality being super useful for Graph/Discover as well. It probably makes sense to start implementing this as a part of Lens, but we should anticipate making this a generic feature in the future. |
Currently when users ask how to add new fields that didn't exist during ingestions. We usually provide two options:
Two main use case for scripted fields
Scripted fields allow users to create new fields in the index pattern which do not exists during the time the data is ingested. Main issues with scripted fields:
How do scripted fields use:
Ways in which users would like to use calculated fields/runtime fields:
|
In the future we want to rethink index pattern, and one part of index patterns are scripted fields. You can basically specify a Painless script that will be executed instead of a field. So basically that script you specify in index pattern management is inlined into all requests.
I think we want to move that more towards the editor (as nearly everything in index patterns). Also there are a couple of common "scripts" users might want to easily execute without needing to write painless. Let me give you an example: A user might have a field that's looking like
12:18:00
as a string. We don't only want to allow the user to use that field as it is, but also give them the capabilities to e.g. "split that field" by the colon and use then the first one. Splitting fields by special characters is common, so I think we might want to have an option for that in the UI. Behind the scenes that would generate the script for that (return doc['fieldname'].value.split(':')[1]
(simplified)) and use that instead of the field (meaning we also must make sureesaggs
andesdocs
will understand scripts directly instead of fields. We could have common options (like split a field, search and replace a field value, etc.) and have sophisticated safe painless scripts for that as templates that we use behind the scenes, thus the user doesn't need to write a complex painless script (because that version was very simplified, and a sophisticated would havenull
checks, etc.).Besides having those scripted templates we also might allow the user to add a custom script directly via the fieldlist (not via the index pattern), since that would allow us to more easily get rid of index patterns later on. We should rather have a way to store those scripts in some kind of library and make them easily reusable later (on any index pattern).
Tags: derived fields / scripted fields / calculated fields
Implementation notes
The first integration will be done using runtime fields saved in the index pattern. Lens provides a way to create new fields and delete/edit existing fields without leaving Lens (using the integration provided here: #88995 ). In a later phase fields saved as part of the Visualization can get added.
The text was updated successfully, but these errors were encountered: