Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Popov <sasho.popov@toptal.com>
  • Loading branch information
barthez and AlexVPopov authored Oct 7, 2022
1 parent 116a2fa commit b9946ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1146,12 +1146,12 @@ rake chewy:journal:apply["$(date -v-1H -u +%FT%TZ)"] # apply journaled changes f
rake chewy:journal:apply["$(date -v-1H -u +%FT%TZ)",users] # apply journaled changes for the past hour on UsersIndex only
```

For the cases when journal has grown up to enormous size, classical way of deletion is not quite possible. Fortunately chewy internally uses [delete-by-query](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-delete-by-query.html#docs-delete-by-query-task-api) ES function which support async execution with batching and [throttling](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html#docs-delete-by-query-throttle).
When the size of the journal becomes very large, the classical way of deletion is not possible. Fortunately, Chewy internally uses [delete-by-query](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docs-delete-by-query.html#docs-delete-by-query-task-api) ES function which supports async execution with batching and [throttling](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html#docs-delete-by-query-throttle).

Available options are listed below, they can by set by ENV variables:
* `WAIT_FOR_COMPLETION` - boolean flag, options controls async execution, It waits by default, when set to `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task
* `REQUESTS_PER_SECOND` - float, The throttle for this request in sub-requests per second
* `SCROLL_SIZE` - integer, Size of the scroll request that powers the operation
The available options, which can be set by ENV variables, are listed below:
* `WAIT_FOR_COMPLETION` - a boolean flag. It controls async execution. It waits by default. When set to `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel the task or get its status.
* `REQUESTS_PER_SECOND` - float. The throttle for this request in sub-requests per second.
* `SCROLL_SIZE` - integer. The size of the scroll request that powers the operation.

```bash
rake chewy:journal:clean WAIT_FOR_COMPLETION=false REQUESTS_PER_SECOND=10 SCROLL_SIZE=5000
Expand Down

0 comments on commit b9946ea

Please sign in to comment.