Skip to content

Commit

Permalink
Fix the simulate rest API when using tags (#1872)
Browse files Browse the repository at this point in the history
When using tags, the simulate option does not merge the provided tags with the extracted document, resulting in a wrong simulation.
  • Loading branch information
dadoonet committed May 3, 2024
1 parent d3918bb commit 5dd56e7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ private UploadResponse uploadToDocumentService(
// Elasticsearch entity coordinates (we use the first node address)
ServerUrl node = settings.getElasticsearch().getNodes().get(0);
String url = node.getUrl() + "/" + index + "/_doc/" + id;
final Doc mergedDoc = this.getMergedJsonDoc(doc, tags);
if (Boolean.parseBoolean(simulate)) {
logger.debug("Simulate mode is on, so we skip sending document [{}] to elasticsearch at [{}].", filename, url);
} else {
logger.debug("Sending document [{}] to elasticsearch.", filename);
final Doc mergedDoc = this.getMergedJsonDoc(doc, tags);
documentService.index(
index,
id,
Expand All @@ -227,7 +227,7 @@ private UploadResponse uploadToDocumentService(

if (logger.isDebugEnabled() || Boolean.parseBoolean(debug)) {
// We send the content back if debug is on or if we got in the query explicitly a debug command
response.setDoc(doc);
response.setDoc(mergedDoc);
}

return response;
Expand Down

0 comments on commit 5dd56e7

Please sign in to comment.