弹性搜索-jdbc-river的sqlparams的任何示例

时间:2013-12-04 07:14:28

标签: elasticsearch elasticsearch-jdbc-river

正如文档所说:sqlparams绑定SQL语句的参数(按顺序) 谁能举个例子?

1 个答案:

答案 0 :(得分:0)

您可以在此处参考:http://elasticsearch-users.115913.n3.nabble.com/Ann-JDBC-River-Plugin-for-ElasticSearch-td4019418.html,搜索“绑定参数”和“基于时间的选择”

  curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
            "type" : "jdbc",
            "jdbc" : {
                "driver" : "com.mysql.jdbc.Driver",
                "url" : "jdbc:mysql://localhost:3306/test",
                "user" : "",
                "password" : "",
                "sql" : "select products.name as \"product.name\", orders.customer as \"product.customer.name\", orders.quantity * products.price as \"product.customer.bill\" from products, orders 
where products.name = orders.product and orders.quantity * products.price > ?",
                "params": [ 5.0 ]
            }
        }'