Source:
<code>public void handleIndexUpdate(Entry entry, ElasticMode command) { if (entry == null) { return; } LOGGER.info("Performing index update with " + command + "."); if (ElasticManager.hostname == null || ElasticManager.hostname.isEmpty()) { LOGGER.error("No elastic search host found."); return; } if (!checkValid(entry, command)) { LOGGER.info("Could not perform the elastic search index update."); return; } String json = getDocumentValueFromEntry(entry); try (RestClient restClient = RestClient.builder(new HttpHost(ElasticManager.hostname, ElasticManager.port, "http")).build()) { String entryType = entry instanceof Tool ? "tool" : "workflow"; HttpEntity entity = new NStringEntity(json, ContentType.APPLICATION_JSON); org.elasticsearch.client.Response post; switch (command) { case UPDATE: post = restClient <START> .performRequest("POST", "/entry/" + entryType + "/" + entry.getId() + "/_update" + "?refresh=wait_for", Collections.emptyMap(), entity); <END> break; case DELETE: post = restClient.performRequest("DELETE", "/entry/" + entryType + "/" + entry.getId() + "?refresh=wait_for", Collections.emptyMap(), entity); break; default: throw new RuntimeException("Unknown index command: " + command); } int statusCode = post.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED) { LOGGER.info("Successful " + command + "."); } else { LOGGER.error("Could not submit index to elastic search. " + post.getStatusLine().getReasonPhrase()); } } catch (IOException e) { LOGGER.error("Could not submit index to elastic search. " + e.getMessage()); } }</code><technical_language>Try putting ?refresh=wait_for in params map (replacing current Collections.emptyMap()</technical_language>

Target:
public void handleIndexUpdate(Entry entry, ElasticMode command) { entry = filterCheckerWorkflows(entry); if (entry == null) { return; } LOGGER.info("Performing index update with " + command + "."); if (ElasticManager.hostname == null || ElasticManager.hostname.isEmpty()) { LOGGER.error("No elastic search host found."); return; } if (!checkValid(entry, command)) { LOGGER.error("Could not perform the elastic search index update."); return; } String json = getDocumentValueFromEntry(entry); try (RestClient restClient = RestClient.builder(new HttpHost(ElasticManager.hostname, ElasticManager.port, "http")).build()) { String entryType = entry instanceof Tool ? "tool" : "workflow"; HttpEntity entity = new NStringEntity(json, ContentType.APPLICATION_JSON); org.elasticsearch.client.Response post; switch (command) { case UPDATE: post = restClient .performRequest("POST", "/entry/" + entryType + "/" + entry.getId() + "/_update", Collections.emptyMap(), entity); break; case DELETE: post = restClient.performRequest("DELETE", "/entry/" + entryType + "/" + entry.getId(), Collections.emptyMap(), entity); break; default: throw new RuntimeException("Unknown index command: " + command); } int statusCode = post.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_CREATED) { LOGGER.info("Successful " + command + "."); } else { LOGGER.info("Could not submit index to elastic search. " + post.getStatusLine().getReasonPhrase()); } } catch (IOException e) { LOGGER.error("Could not submit index to elastic search. " + e.getMessage()); } }