Source:
<code>public void handleIndexUpdate(Entry entry, StateManagerMode command) { eagerLoadEntry(entry); entry = filterCheckerWorkflows(entry); entry = entry instanceof Service ? null : entry; if (entry == null) { return; } LOGGER.info("Performing index update with " + command + "."); if (hostname == null || 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; json = getDocumentValueFromEntry(entry); try (RestClient restClient = RestClient.builder(new HttpHost(hostname, port, "http")).build()) { String entryType = entry instanceof Tool ? "tools" : "workflows"; HttpEntity entity = new NStringEntity(json, ContentType.APPLICATION_JSON); Response post; switch (command) { case PUBLISH: case UPDATE: post = restClient .performRequest("POST", "/" + entryType + "/_doc/" + entry.getId() + "/_update", Collections.emptyMap(), entity); break; case DELETE: <START> post = restClient.performRequest("DELETE", "/" + entryType + "/_doc/" + entry.getId(), Collections.emptyMap(), entity); <END> 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 (Exception e) { LOGGER.error("Could not submit index to elastic search. " + e.getMessage()); } }</code><technical_language>this, this path line 111. good a variable avoid duplication</technical_language>

Target:
public void handleIndexUpdate(Entry entry, StateManagerMode command) { eagerLoadEntry(entry); entry = filterCheckerWorkflows(entry); entry = entry instanceof Service ? null : entry; if (entry == null) { return; } LOGGER.info("Performing index update with " + command + "."); if (hostname == null || 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; json = getDocumentValueFromEntry(entry); try (RestClient restClient = RestClient.builder(new HttpHost(hostname, port, "http")).build()) { String entryType = entry instanceof Tool ? "tools" : "workflows"; HttpEntity entity = new NStringEntity(json, ContentType.APPLICATION_JSON); String baseEndpoint = "/" + entryType + "/_doc/" + entry.getId(); Response post; switch (command) { case PUBLISH: case UPDATE: post = restClient .performRequest("POST", baseEndpoint + "/_update", Collections.emptyMap(), entity); break; case DELETE: post = restClient.performRequest("DELETE", baseEndpoint, 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 (Exception e) { LOGGER.error("Could not submit index to elastic search. " + e.getMessage()); } }