1

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

4

1 回答 1

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 ]
            }
        }'
于 2013-12-06T07:16:25.053 回答