BulkProcessor using BulkRequest with wait_for


We are trying to set a "wait_for" refresh policy for every bulk request we are performing. It seems the only way is setting this policy on the 'beforeBulk' method on the bulk listener in this way:

public void beforeBulk(long executionId, BulkRequest request) {`

The idea behind this is: we are performing searches on this index, but we want to hold a search if there are documents involved in it that were indexed by a previous bulk request but they have not been refreshed yet. Once these documents are refreshed, then the search will be executed.

Since the ES docs say:

  • Never start multiple refresh=wait_for requests in a row. Instead batch them into a single bulk request with refresh=wait_for and Elasticsearch will start them all in parallel and return only when they have all finished.

We understand the above code is the right way to achieve this. Are we right?



This looks correct to me.

Thanks David.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.