简体   繁体   English

Apache NIFi MergeContent处理器 - 将分界符设置为新行

[英]Apache NIFi MergeContent processor - set demarcator as new line

I want to use MergeContent processor to merge tweets to bulk insert into Elasticsearch index. 我想使用MergeContent处理器将推文合并到Elasticsearch索引中。 For this I need command and tweets (each) to be separated by \\n. 为此我需要命令和推文(每个)由\\ n分隔。 This is how it should look like 它应该是这样的

{ action: { metadata }}\n
{ request body        }\n

Which will be 这将是

{ “index”}
{ tweet1 }
{ tweet2 } 

When I put \\n as separator the processor actually adds \\n as a string instead of new line separator. 当我把\\ n作为分隔符时,处理器实际上将\\ n添加为字符串而不是新的行分隔符。 Is it possible to make it actual new line? 有可能使它成为真正的新线吗? Also is it possible to leave or make footer empty? 也可以将页脚留空?

Thanks in advance. 提前致谢。

You are correct in that it takes the literal representation of what is entered. 你是对的,因为它需要输入内容的字面表示。 There are two ways to handle this: 有两种方法可以解决这个问题:

  1. With delimiter strategy of 'Text': Hit shift + enter to provide a new line 使用“文本”的分隔符策略:命中shift + enter以提供新行
  2. With delimiter strategy of 'Filename': Provide a path to a file that is only a newline character 使用“文件名”的分隔符策略:提供仅作为换行符的文件的路径

With regards to your question on leaving the footer empty, it should work as you anticipate for the Merge Format of 'Binary Concatenation.' 关于将页脚留空的问题,它应该按照您预期的“二进制连接”的合并格式工作。 Making a quick test flow, I have verified this, but please let us know if it is not working for your particular configuration. 快速测试流程,我已经验证了这一点,但如果它不适用于您的特定配置,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM