我想执行Elasticsearch(Kibana).中的select * from table1、select * from table2、select * from table3、.select * from table80.(基本上从80个不同的表中提取数据并将数据发送给80个不同的索引)。
我是否可以在一个查询数据库表中提供多个select * statement,然后将其路由到不同的索引?如果是的话,流量会是怎样的?
发布于 2018-12-14 23:24:52
有几种方法可以用来解决这个问题。
table1、table2等,您可以简单地生成80个流文件,每个文件在属性中都有一个唯一的整数值(即table_count),并使用GenerateTableFetch和ExecuteSQL通过表达式语言使用该属性创建查询。users、addresses等),则可以从列在一行上的文件中读取,或者使用ListDatabaseTables查询数据库中的名称。然后,您可以执行简单的文本处理,将创建的流文件拆分为每个表一个,并继续如上。发布于 2018-12-14 23:21:58
QueryDatabaseTable不允许传入连接,所以它是not possible。
但是,您可以使用以下流程实现相同的用例
流:
1. ListDatabaseTables
2. RouteOnAttribute //*optional* filter only required tables
3. GenerateTableFetch //to generate pages of sql queries and store state
4. RemoteProcessGroup (or) Load balance connection
5. ExecuteSql //run more than one concurrent task if needed
6. further processing
7. PutElasticSearch.此外,如果您不想运行流incrementally,那么删除GenerateTableFetch处理器
ExecuteSql处理器,选择查询作为
select * from ${db.table.schema}.${db.table.name}一些有用的参考资料:
https://stackoverflow.com/questions/53786949
复制相似问题