yunojuno/elasticsearch-django

Adding wait_for when index is being updated

Closed this issue · 1 comments

Hi there,
have a problem when I'm writing tests for elasticsearch. every time I need to add something like time.sleep() in the test code to wait while ES index is updated.
I'd like to use wait_for params but cannot find the nice way to use it.
Do you have any solutions?

def elasticsearch_monkeypatch(monkeypatch):
    patched_index = functools.partialmethod(
        Elasticsearch.index,
        refresh='wait_for')
    monkeypatch.setattr(Elasticsearch, 'index', patched_index)