You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Abdou Bourakba (JIRA)" <ji...@apache.org> on 2019/01/29 15:42:00 UTC

[jira] [Created] (NIFI-5982) Processor PutElasticsearchHttpRecord should a relation Response

Abdou Bourakba created NIFI-5982:
------------------------------------

             Summary: Processor PutElasticsearchHttpRecord should a relation Response
                 Key: NIFI-5982
                 URL: https://issues.apache.org/jira/browse/NIFI-5982
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Extensions
    Affects Versions: 1.5.0
            Reporter: Abdou Bourakba


When Using the processor  PutElasticsearchHttpRecord,

Nifi send request to Elastic bulk interface. the Request include multiple lines.

If the request fails, we have no indications which of the lines were rejected.

However in the response that ES sends the details of successfull or failed operations are included.

That's why I think a response relation would be useful.

The modification is not very hard to implement, but I think it could be usefull to treat failure during the Bulk operation.  here below a exemple of implementation : 

 
{code:java}
// code 
if (isSuccess(statusCode)) {
    ResponseBody responseBody = getResponse.body();
    try {
        final byte[] bodyBytes = responseBody.bytes();
        JsonNode responseJson = parseJsonResponse(new ByteArrayInputStream(bodyBytes));
        FlowFile fileResponse = session.create();
        fileResponse = session.write(fileResponse, new OutputStreamCallback() {
            @Override
            public void process(final OutputStream out) throws IOException {
                getLogger().debug(responseJson.toString());
                out.write(responseJson.toString().getBytes());
            }
        });
{code}
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)