[
https://issues.apache.org/jira/browse/NIFI-5266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502347#comment-16502347
]
ASF GitHub Bot commented on NIFI-5266:
--------------------------------------
Github user ottobackwards commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2760#discussion_r193189510
--- Diff:
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-processors/src/test/java/org/apache/nifi/processors/elasticsearch/PutElasticsearchHttpRecordIT.java
---
@@ -227,6 +227,29 @@ public void testBadIndexName() throws Exception {
runner.assertTransferCount(PutElasticsearchHttpRecord.REL_SUCCESS,
0);
}
+ @Test
+ public void testIndexNameWithJsonChar() throws Exception {
+ // Undo some stuff from setup()
+ runner.setProperty(PutElasticsearchHttpRecord.INDEX,
"people}test");
+ runner.setProperty(PutElasticsearchHttpRecord.TYPE, "person");
+ recordReader.addRecord(1, new MapRecord(personSchema, new
HashMap<String,Object>() {{
+ put("name", "John Doe");
+ put("age", 48);
+ put("sport", null);
+ }}));
+
+ List<Map<String, String>> attrs = new ArrayList<>();
+ Map<String, String> attr = new HashMap<>();
+ attr.put("doc_id", "1");
+ attrs.add(attr);
+
+ runner.enqueue("");
+ runner.run(1, true, true);
+ runner.assertTransferCount(PutElasticsearchHttpRecord.REL_FAILURE,
0);
+ runner.assertTransferCount(PutElasticsearchHttpRecord.REL_RETRY,
0);
--- End diff --
ah, ok sorry. Sometimes the intent isn't clear just looking at the test
without a descriptive name or comment. Sorry
> PutElasticsearchHttp processors should sanitize parameters
> ----------------------------------------------------------
>
> Key: NIFI-5266
> URL: https://issues.apache.org/jira/browse/NIFI-5266
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: Matt Burgess
> Assignee: Matt Burgess
> Priority: Major
>
> Currently PutElasticsearchHttp and PutElasticsearchHttpRecord put the
> property values for index, type, and id into the Bulk API command as they are
> specified in the processor properties. This can cause errors when special
> characters such as a double-quote (") is encountered. Although a double-quote
> (for example) is not supported in an index name, it is valid in a type name
> and should be allowed.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)