Closed scottinet closed 3 years ago
Thanks for adding this feature request. Just to add to this...
Without this feature, options are:
A: Call exists
, wait for a response, then based on the response, call either create
or update
.
B: Aggregate our messages into a ktable and fire the compiled result of that into the kuzzle collection.
Given that kuzzle supports dynamic fields on documents and elasticsearch provides upsert
functionality, seems reasonable to have this available in kuzzle.
Equivalent ES:
POST test/_update/1
{
"doc": {
"name": "new_name"
},
"doc_as_upsert": true
}
Document
Now this one is a bit counterintuitive. Until now, there weren't use cases for an upsert API route. Because document updates apply partial content modification to documents, it's normally not something we want to create a new document on the fly with only partial content.
However, here is a use case coming from one of our clients, which to me seems to justify the addition of that new route to Kuzzle:
In that specific case, it is desirable to add partial content to a document, or to create a new one on the fly if needed.