agturley commented on code in PR #11299:
URL: https://github.com/apache/nifi/pull/11299#discussion_r3336175298
##########
nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-restapi-processors/src/main/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchJson.java:
##########
@@ -245,6 +249,67 @@ public class PutElasticsearchJson extends
AbstractPutElasticsearch {
.dependsOn(INPUT_FORMAT, InputFormat.NDJSON,
InputFormat.JSON_ARRAY)
.build();
+ static final PropertyDescriptor RETAIN_IDENTIFIER_FIELD = new
PropertyDescriptor.Builder()
+ .name("Retain Identifier Field")
+ .description("""
+ Whether to keep the Identifier Field in the document body
after extracting it \
+ for use as the Elasticsearch document ID. \
+ When false (default), the field is removed from the
document before indexing.\
+ """)
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("false")
+ .dependsOn(INPUT_FORMAT, InputFormat.NDJSON,
InputFormat.JSON_ARRAY)
+ .build();
+
+ static final PropertyDescriptor INDEX_FIELD = new
PropertyDescriptor.Builder()
+ .name("Index Field")
+ .description("""
+ The name of the field within each document to use as the
Elasticsearch index name. \
+ If the field is not present in a document or this property
is left blank, \
+ the configured Index property value is used as the
fallback.\
+ """)
+ .required(false)
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
+ .build();
+
+ static final PropertyDescriptor RETAIN_INDEX_FIELD = new
PropertyDescriptor.Builder()
+ .name("Retain Index Field")
+ .description("""
+ Whether to keep the Index Field in the document body after
extracting it \
+ for use as the Elasticsearch index name. \
+ When false (default), the field is removed from the
document before indexing.\
+ """)
+ .required(true)
+ .allowableValues("true", "false")
+ .defaultValue("false")
+ .build();
Review Comment:
Added. Each retain flag now depends on its field, so they're hidden until
you set the field. Turned out onTrigger was also reading those properties even
when the field wasn't set, which isn't allowed once a dependsOn is in place, so
I fixed those reads too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]