简体   繁体   English

NiFi:使用ExecuteScript的QueryRecord

[英]NiFi: QueryRecord using ExecuteScript

I consume data from a kafka topic ( nested json ) which has to be filtered based on a field value. 我使用来自kafka主题( nested json )的数据,该主题必须根据字段值进行过滤。 So I used the ExecuteScript processor to filter out records and transform some fields. 因此,我使用ExecuteScript processor来过滤出记录并转换某些字段。 For filtering I used findAll function without using QueryRecord and it worked. 为了进行过滤,我使用了findAll函数而不使用QueryRecord,它起作用了。

My question here is does this approach solve the same purpose as QueryRecord processor for filtering because I'm NOT sure how to use query record when there are nested json objects from the incoming flowfiles. 我的问题是,这种方法是否实现了与QueryRecord处理器相同的过滤目的,因为当从传入流文件中嵌套json对象时,我不确定如何使用查询记录。

I tried queryrecord but it threw an error: 我尝试使用queryrecord,但抛出错误:

SELECT * FROM FLOWFILE WHERE RPATH(order, '/orderDetail/orderId') = '1126'

Error:
No match found for function signature RPATH(<JavaType(...Record)>,<CHARACTER>)
org.apache.calcite.runtime.CalciteContextException

Sample Data:

{  
   "retail":{  
      "retailId":"6133",
      "retailName":"Maveric"
   },
   "order":{  
      "orderDetail":{  
         "orderId":"1126",
         "orderName":"NNDRFG"
      }
   }
}

RPATH_STRING is not the correct syntax, it is just RPATH. RPATH_STRING不是正确的语法,仅是RPATH。

See the additional details documentation for QueryRecord: 请参阅QueryRecord的其他详细信息文档:

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.9.2/org.apache.nifi.processors.standard.QueryRecord/additionalDetails.html

It has an example of JSON with nested fields. 它有一个带有嵌套字段的JSON示例。

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

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