-
Notifications
You must be signed in to change notification settings - Fork 1.2k
BulkUpdateDescriptor & DocAsUpsert Not Working in Latest Dev Branch #773
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
Comments
Hey @nariman-haghighi, you bring up an interesting issue here. Yes, Object() has been removed and replaced with Document(), but they also function differently. Document() is only used to infer the ID of the document that you want to apply a partial update to. There is now an UpdatePartial() method that acts as the old Object() (i.e. serializes to "doc"). It's a bit confusing, and I'm not sure the exact reasoning behind it- will have to ping @Mpdreamz and get his take on it. My guess is that in most uses cases, if you are applying a partial update, you don't want to pass the entire C# object, as some of the fields that aren't populated will override your document in ES with the default values. So you'd want to do this instead:
However, in your case, I think this might work:
Or even:
Let me know how that goes and thank you for bringing this to our attention. We'll definitely have rethink this for the GA release, or mention it in the breaking changes section of the release notes, as it's more than just renaming Object to Document. |
Yes, the 2nd example above Document(m).PartialUpdate(m) works as expected without sending the full document twice. Because we're habituated to the behaviour pre-partial updates, our documents are designed with nesting so that each update provides only the relevant sub-document (and null for everything) else so as to not override the fields in ES that are not a part of the update (NULL should not replace existing values). Basically we can pass m in whole and not worry about it. |
Ah, gotcha. Great, glad that worked. |
Dang, sorry for the switcheroo going on here @nariman-haghighi It was not on my radar that Moving forward I very much prefer the new syntax over the old though e.g:
over
Thanks for catching this. Its also very interesting to hear that you've designed your POCO's to specifically allow for this, I never envisioned this to be honest. The update that only takes one type was mainly there for the cases where you want to infer from |
And what about UpdateDescriptor? It's still using the .Object(m).Document(m).DocAsUpsert(true) format. |
@nariman-haghighi Yup, they are inconsistent. We're going to have to go back to the drawing border here and think of a better solution for the update api. Leaving this issue open until then. Thanks again. |
@nariman-haghighi @gmarz I opened a PR to try and streamline our API around both updates. Would love your comments. |
Closing this now that #795 has been pulled in. |
It seems
.Object
was removed onBulkUpdateDescriptor
recently and the following usage:... is now generating: script or doc is missing. We previously had .Document(m).Object(m).DocAsUpsert(true) working correctly.
The text was updated successfully, but these errors were encountered: