You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improved support for refresh during updates (#323)
* Increase configurability of bulk refresh parameter
The Elasticsearch bulk APIs support a configurable 'refresh' parameter
that can be set to:
1. empty string / true : perform refresh after operation completes
2. 'wait_for': wait until next scheduled refresh
3. false (default): don't do any refresh
See documentation at:
https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-refresh.html
Currently the `Document.update()` API accepts a `refresh` parameter
that, if `True`, passes `True` to the ES bulk API. There isn't currently
a way to pass 'wait_for'.
This commit modifies how `Document.update()` works so that it is
possible to pass `refresh='wait_for'`. I've implemented this in a
generic way, as opposed to hardcoding logic for 'wait_for', to support
future changes to this ES bulk API.
Note that, in keeping with the current convention, if
`refresh='wait_for'` is passed, this will override the value of
auto_refresh set either via setting or via the Document class. This
gives developers the maximum configurability here.
* Add support for --refresh to search_index command
Currently when updating or rebuilding an index, the `refresh` parameter
is never set, regardless if settings.ELASTICSEARCH_DSL_AUTO_REFRESH is
set or if auto_refresh is set on the Document class.
This commit adds the ability to pass `--refresh` to the `search_index`
management command, to force a refresh when the index is updated.
This can be useful, for example, if you want to programmatically call
that command from some Django tests that fill an index, and then
immediately run tests against that index. Without setting
`refresh=True`, there's no guarantee that the refreshed index will be
available to search.
* Update refresh parameter overrides auto_refresh
* Support Document.auto_refresh = 'wait_for'
0 commit comments