UpdateByQueryRequestBuilder and versionConflicts

Hello,

I have a question about the update by query method, in my java application my method look like this :

public ActionFuture<BulkByScrollResponse> executeUpdateByQuery(String indexName, Map<String, Object> filterFileds, Map<String, Object> updateFields, Map<String, Object> excludeFileds)    throws InterruptedException, ExecutionException {

        Script script = createScript(updateFields);
        LOGGER.info(script.toString());

        BoolQueryBuilder query = ElasticsearchUtils.createQuery(filterFileds, excludeFileds);
        UpdateByQueryAction updateByQueryAction = UpdateByQueryAction.INSTANCE;
        UpdateByQueryRequestBuilder requestBuilder = updateByQueryAction.newRequestBuilder(esClient);
        requestBuilder.abortOnVersionConflict(false).setMaxRetries(5).script(script).filter(query).source(indexName)
                .refresh(true);

        esClient.admin().indices().prepareRefresh(indexName).get();

        LOGGER.info("update request: {}", requestBuilder.source().toString());

        return requestBuilder.execute();
    }

My question is about the result of bulkByScrollResponse, when I display the logs sometimes I get a versionConflict not null but my document is succefully updated and sometimes the versionConflict
is also not null but the document is not updated.

How can I handle this exception correctly?

Thank you for your response

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