Replies: 8 comments 33 replies
-
If the user has a timestamp field and wants to extract month and year from it, what happens? Do you end up with an index pattern field list of:
or do the subFields get added to the timestamp field, thereby making it impossible for the user to use that field anymore as a date field? |
Beta Was this translation helpful? Give feedback.
-
Can you add the proposed Type/Public API Item changes? What is the |
Beta Was this translation helpful? Give feedback.
-
@sebelga I think the index pattern field list should only be leaf fields and the 'parent' definition should only exist in the runtime field definitions. Introducing an 'object' field type would potentially mean making changes to all code that takes the field list as an argument. Instead, we could add a 'runtimeParent' attribute to the IndexPatternField when its the product of an object runtime field. This would also sidestep the need to modify the field formatting code to work with subfields. |
Beta Was this translation helpful? Give feedback.
-
After discussing with @mattkime we will do something slightly different to completely align with what is currently in place and not have suddenly object parent field in the list of fields of the index pattern.
With that in mind we are going to add a new top level properties When creating an object runtime field we will:
|
Beta Was this translation helpful? Give feedback.
-
@mattkime @stacey-gammon I've updated the discussion with the updated proposal if you want to have another look 👍 |
Beta Was this translation helpful? Give feedback.
-
@ppisljar - We should get your thoughts |
Beta Was this translation helpful? Give feedback.
-
I've updated the description with a second option to have a dedicated |
Beta Was this translation helpful? Give feedback.
-
if i am reading this correct we have an agreement on how to proceed ?
questions:
|
Beta Was this translation helpful? Give feedback.
-
Problem
Object runtime fields give the user the possibility to declare multiple sub fields inside a parent object through a script. For that the user will
emit
multiple value from the painless script as a set of key/value pairs. The problem is: this single runtime field, once saved in the Kibana index pattern, will appear as one field and none of the sub fields will be exposed. When an app (Lens, Discover) will ask for the list of fields on the index pattern it will then receive this top object runtime field and none of the associated sub fields.Proposal
I suggest the following:
Returning a
subFields
map of leaf runtime fieldsThe field editor would return a new optional
subFields
property on the runtime field (following the naming convention in place for concrete fields)Adding a
parent
prop to theRuntimeField
interfaceThis is the new interface returned by the field editor (it is internal to the plugin)
Add a new top level property
runtimeObjects
to the index patternSo the IndexPattern interface becomes
Option 1: Update the
addRuntimeField()
handler to now receive a map of fields and optional runtime objectHere is the current handler.
Option 2: Add a new
addRuntimeObject()
handler to save runtime objectsWe keep the current
addRuntimeField()
handler as it is and we add a new handler to save runtime objects along with its sub fieldsThis will allow us the normal CRUD operation like other runtime fields:
Create: As mentioned above we will update the addRuntimeField() to support saving multiple runtime fields + optionally a runtime object.
Edit: When editing an leaf object (e.g.
myRuntimeObject.foo
) we will:parent
which is also a runtime field (with a runtimeField definition + ascript
)script
section, just like any concrete field (with custom label, format, priority). We would add an callout indicating to the user that this field comes from an object runtime field with a link to edit the parent object field to change its value.Delete: To delete a leaf object field we would open a modal saying that this field has been generated by an object runtime field script and that the user needs to modify the parent's
script
to delete the field. There will be a button for the user to open the field editor and edit the script in order to remove the child field.Support format for sub fields
We also need to update the logic to add the
format
definition for each subField to the index pattern attributes (here: index pattern field editor)Update the logic to add runtime fields to the search query
We will also need to update the code where we add the runtime fields to the search query. This should.be straightforward as we will simply need to filter out the runtime fields that have a
parent
and only add the parent (theruntimeObject
associated).cc @mattkime @stacey-gammon
Beta Was this translation helpful? Give feedback.
All reactions