django-elasticsearch-dsl icon indicating copy to clipboard operation
django-elasticsearch-dsl copied to clipboard

registry.update() to update specific field on a document

Open rootgrandfather opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe.A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I use registry.update() to synchronously update elasticsearch document when a model instance changes,but this function always update all fields on the document,for example,a model blog has a field 'vcnt' to record the view counts,when a blog was viewed,the update action will be performed,but the document has a field containg the large content of the blog,this field also be updated,but i just want change the 'vcnt' field. Describe the solution you'd like A clear and concise description of what you want to happen. When registry.update() performs update action between es document and django model,update the related or specific fields on the document. Describe alternatives you've considered.A clear and concise description of any alternative solutions or features you've considered. Add an extra argument in function registry.update(),such as registry.update(update_fields=["xxx"]),to update the specific fields on a document. Additional context.Add any other context or screenshots about the feature request here. Related code. code

rootgrandfather avatar Jun 14 '20 13:06 rootgrandfather