Open
Enhancement
Description
At the moment, it is not possible to sort the results of 2 Saved Object types in the same find
request if the sorting field is not a root field.
I believe that the underlying reason is that, even if the field name is the same (i.e.: name.keyword
), they are actually persisted in ES as different fields (<type 1>.name.keyword
, <type 2>.name.keyword
), so sorting would be inaccurate.
I wonder if we could work around this limitation on ES by adding a runtime field that merges all fields
# Pseudo code
runtime_field.name.keyword = <type 1>.name.keyword ?? <type 2>.name.keyword
Then, we sort via the runtime field.
Use cases
This is mostly required by those SOs that needed to be duplicated when moving from agnostic
to multi-space
: #221568