Apache Nifi 获取Solr配置时不包含日期字段
创始人
2024-09-04 12:01:00
0

在Apache NiFi中,可以使用EvaluateJsonPath处理器来获取Solr配置时不包含日期字段的解决方法。下面是一个示例流程:

  1. 添加一个GetSolr配置处理器,配置Solr的URL和Collection名称。
  2. 添加一个EvaluateJsonPath处理器,将返回的Solr配置解析为JSON对象。
  3. 在EvaluateJsonPath处理器的属性中,添加一个自定义属性,设置属性名为"dateField",设置JSON路径表达式为"$.dateField"。这将提取出Solr配置中的日期字段。
  4. 添加一个RouteOnAttribute处理器,将日期字段的值为空的文档路由到一个不同的分支。
  5. 在RouteOnAttribute处理器的属性中,添加一个动态属性,设置属性名为"dateField",设置属性值为"${dateField:isEmpty()}"。这将检查日期字段是否为空。
  6. 添加一个PutSolrContentStream处理器,将日期字段不为空的文档发送回Solr。

下面是一个示例的NiFi流程的JSON配置:

{
  "name": "Solr Configuration",
  "id": "4f8a0e4a-0157-1000-ffff-ffffa5d0d8fd",
  "comments": "Solr Configuration",
  "isolated": false,
  "inputRequirement": "INPUT_REQUIRED",
  "config": {
    "properties": {
      "SolrUrl": "http://localhost:8983/solr",
      "SolrCollection": "mycollection"
    }
  },
  "component": {
    "name": "GetSolr",
    "type": "org.apache.nifi.processors.solr.GetSolr",
    "id": "4f8a0e4a-0157-1000-ffff-ffffa5d0d8fd",
    "bundle": {
      "group": "org.apache.nifi",
      "artifact": "nifi-solr-nar",
      "version": "1.13.2"
    }
  },
  "connections": [
    {
      "id": "4f8a0e4a-0157-1000-ffff-ffffa5d0d8ff",
      "source": {
        "id": "4f8a0e4a-0157-1000-ffff-ffffa5d0d8fd",
        "relationship": "success"
      },
      "destination": {
        "id": "4f8a0e4a-0157-1000-ffff-ffffa5d0d8fe",
        "relationship": "success"
      },
      "flowFileExpiration": "0 sec",
      "backPressureDataSizeThreshold": "1 GB",
      "backPressureObjectThreshold": "10000",
      "bends": [
        
      ]
    }
  ],
  "processGroups": [
    
  ],
  "remoteProcessGroups": [
    
  ],
  "labels": [
    
  ],
  "funnels": [
    
  ],
  "controllerServices": [
    
  ],
  "idGenerationSeed": 1,
  "position": {
    "x": 273.0,
    "y": 64.0
  }
}

请注意,以上示例中的日期字段名称为"dateField",你需要根据你的实际情况进行相应的更改。

相关内容

热门资讯

透视工具!aapoker安装包... 透视工具!aapoker安装包怎么使用(透视)aapoker万能辅助器,AA德州教程(有挂揭秘)1、...
透视数据!aapoker辅助工... 透视数据!aapoker辅助工具安全吗(透视)aapoker插件,安装教程(有挂细节);1、这是跨平...
透视总结!aapoker怎么设... 透视总结!aapoker怎么设置提高好牌几率(透视)aapoker辅助器是真的吗,解密教程(有挂揭秘...
透视系统!aapoker如何设... 透视系统!aapoker如何设置胜率(透视)aa poker透视软件,2025新版教程(有挂解说)1...
透视挂!aapoker辅助器怎... 透视挂!aapoker辅助器怎么用(透视)aapoker ai插件,解密教程(有挂揭秘)1.aapo...
透视中牌率!aa poker透... 透视中牌率!aa poker透视软件(透视)aapoker透视插件,解密教程(有挂解说)1、操作简单...
透视规律!aapoker免费透... 透视规律!aapoker免费透视脚本(透视)aapoker插件下载,AI教程(有挂揭秘)1、aapo...
透视新版!aapoker辅助工... 透视新版!aapoker辅助工具安全吗(透视)aapoker万能辅助器,教你攻略(有挂黑科技)1、构...
透视系统!aapoker安装包... 透视系统!aapoker安装包怎么使用(透视)aapoker透视插件,解说技巧(有挂细节)小薇(透视...
透视透视!aapoker俱乐部... 透视透视!aapoker俱乐部靠谱吗(透视)aapoker俱乐部靠谱吗,黑科技教程(有挂细节);1、...