Update users ES index directly on save

(don't merge yet)
@czue @dannyroberts 
Waiting until tomorrow to test this out on staging, but locally it works (I see updates to users in ES even with pillowtop off).  Depends on https://github.com/dimagi/pillowtop/pull/91
Django signals is basically just a simple publish/subscribe system.

It has other nice syntax features, and specific Django integrations (like
Django models emitting pre_save and post_save signals, that other functions
can subscribe to) most of which we don't use consistently (
https://docs.djangoproject.com/en/dev/topics/signals/). But you can think
of "subscribing" to a signal as literally just adding yourself to a list of
functions and "publishing" to it literally as just going through that list
of functions and running them; i.e. there's no real magic happening.



On Thu, Sep 25, 2014 at 12:09 PM, Ethan Soergel <notifications@github.com>
wrote:

> In corehq/apps/users/models.py:
>
> > @@ -1207,6 +1207,9 @@ def save(self, **params):
> >
> >          super(CouchUser, self).save(**params)
> >
> > +        from corehq.elastic import send_to_elasticsearch
> > +        res = send_to_elasticsearch("users", self.to_json())
>
> maybe? I also meant to move that import to the top before PRing. I haven't
> really used django Signals before, could you give me a rundown some time?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/dimagi/commcare-hq/pull/4393/files#r18041584>.
>