UpdateByQueryRequestBuilder and versionConflicts

(Alex) #1


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);

        BoolQueryBuilder query = ElasticsearchUtils.createQuery(filterFileds, excludeFileds);
        UpdateByQueryAction updateByQueryAction = UpdateByQueryAction.INSTANCE;
        UpdateByQueryRequestBuilder requestBuilder = updateByQueryAction.newRequestBuilder(esClient);


        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

(system) #2

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