Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Kondaka <[email protected]>
  • Loading branch information
Krishna Kondaka committed Jan 4, 2024
1 parent 0cc3b09 commit 25956ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,11 @@ private SerializedJson getDocument(final Event event) {
if (routingField != null) {
routingValue = event.get(routingField, String.class);
} else if (routing != null) {
if (expressionEvaluator.isValidFormatExpression(routing)) {
routingValue = event.formatString(routing, expressionEvaluator);
} else {
routingValue = event.get(routing, String.class);
}
try {
routingValue = event.formatString(routing, expressionEvaluator);
} catch (final ExpressionEvaluationException | EventKeyNotFoundException e) {
LOG.error("Unable to construct routing with format {}, the document_id will be generated by OpenSearch", routing, e);
}
}

final String document = DocumentBuilder.build(event, documentRootKey, sinkContext.getTagsTargetKey(), sinkContext.getIncludeKeys(), sinkContext.getExcludeKeys());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static IndexConfiguration readIndexConfig(final PluginSetting pluginSetti
final String routingField = pluginSetting.getStringOrDefault(ROUTING_FIELD, null);
final String routing = pluginSetting.getStringOrDefault(ROUTING, null);
if (routingField != null) {
LOG.warn("routing_field is deprecated in favor of routing, and support for document_field will be removed in a future major version release.");
LOG.warn("routing_field is deprecated in favor of routing, and support for routing_field will be removed in a future major version release.");
builder = builder.withRoutingField(routingField);
} else if (routing != null) {
builder = builder.withRouting(routing);
Expand Down

0 comments on commit 25956ce

Please sign in to comment.