You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/saved-objects/core-saved-objects-server/docs/model_versions.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -893,9 +893,11 @@ to the `fields` option **were already present in the prior model version**. Othe
893
893
during upgrades, where newly introduced or backfilled fields may not necessarily appear in the documents returned
894
894
from the `search` API when the option is used.
895
895
896
-
### Using `update` with dynamically backfilled fields
896
+
### Using `bulkUpdate` with dynamically backfilled fields
897
897
898
-
The savedObjects `update` API is effectively a partial update (using Elasticsearch's `_update` under the hood),
898
+
(Note: this same limitation used to exist for the `update` method but has been [fixed](https://github.com/elastic/kibana/issues/165434). So while they're similar this limitation is only relevant for the `bulkUpdate` method)
899
+
900
+
The savedObjects `bulkUpdate` API is effectively a partial update (using Elasticsearch's `_update` under the hood),
899
901
allowing API consumers to only specify the subset of fields they want to update to new values, without having to
900
902
provide the full list of attributes (the unchanged ones). We're also not changing the `version` of the document
901
903
during updates, even when the instance performing the operation doesn't know about the current model version
@@ -935,8 +937,14 @@ const newDocAttributes = {
935
937
Which could occur either while being still in the cohabitation period, or in case of rollback:
936
938
937
939
```ts
938
-
savedObjectClient.update('type', 'id', {
939
-
index: 11,
940
+
savedObjectClient.bulkUpdate({
941
+
objects: [{
942
+
type: 'type',
943
+
id: 'id',
944
+
attributes: {
945
+
index: 11
946
+
}
947
+
}]
940
948
});
941
949
```
942
950
@@ -949,7 +957,7 @@ We will then be in a situation where our data is **inconsistent**, as the value
949
957
}
950
958
```
951
959
952
-
The long term solution for that is implementing [backward-compatible updates](https://github.com/elastic/kibana/issues/152807), however
960
+
The long term solution for that is implementing [backward-compatible updates](https://github.com/elastic/kibana/issues/165434), however
953
961
this won't be done for the MVP, so the workaround for now is to avoid situations where this edge case can occur.
0 commit comments