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",你需要根据你的实际情况进行相应的更改。

相关内容

热门资讯

透视了解!hhpoker是正品... 透视了解!hhpoker是正品吗,aa poker辅助包,资料教程(有挂秘籍)-哔哩哔哩hhpoke...
透视玄学!hhpoker透视工... 透视玄学!hhpoker透视工具,hhpoker免费辅助器,办法教程(有挂方针)-哔哩哔哩1、全新机...
透视新版!wepoker怎么挂... 透视新版!wepoker怎么挂底牌,wepoker好友助力码,手段教程(真是有挂)-哔哩哔哩所有人都...
透视透视挂!wepoker有没... 透视透视挂!wepoker有没有挂,hhpoker辅助软件是真的么,课程教程(讲解有挂)-哔哩哔哩1...
透视辅助!红龙poker辅助工... 透视辅助!红龙poker辅助工具,wepoker有没有插件,教程书教程(有挂教学)-哔哩哔哩1、任何...
透视安装!wepokerplu... 透视安装!wepokerplus开挂,如何下载wpk透视版,攻略教程(有挂方式)-哔哩哔哩1、进入游...
透视了解!wpk辅助是什么,h... 透视了解!wpk辅助是什么,hhpoker辅助挂,练习教程(发现有挂)-哔哩哔哩1、这是跨平台的wp...
透视辅助!xpoker辅助器,... 透视辅助!xpoker辅助器,大菠萝免费辅助器,学习教程(了解有挂)-哔哩哔哩1、让任何用户在无需大...
透视规律!智星德州辅助译码插件... 透视规律!智星德州辅助译码插件靠谱吗,德州hhpoker脚本,积累教程(发现有挂)-哔哩哔哩1、下载...
透视透视!hhpoker透视方... 透视透视!hhpoker透视方法,来玩德州破解器,办法教程(了解有挂)-哔哩哔哩1、该软件可以轻松地...