Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
- "type" : "jdbc",
- "jdbc" : {
- "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"
- }
- }'
- mysql> select products.name as "product.name", orders.customer as "product.customer", orders.quantity * products.price as "product.customer.bill" from products, orders where products.name = orders.product ;
- +--------------+------------------+-----------------------+
- | product.name | product.customer | product.customer.bill |
- +--------------+------------------+-----------------------+
- | Apples | Big | 1 |
- | Bananas | Large | 2 |
- | Oranges | Huge | 6 |
- | Apples | Good | 2 |
- | Oranges | Bad | 9 |
- +--------------+------------------+-----------------------+
- 5 rows in set, 5 warnings (0.00 sec)
- id=0 {"product":{"name":"Apples","customer":{"bill":1.0,"name":"Big"}}}
- id=1 {"product":{"name":"Bananas","customer":{"bill":2.0,"name":"Large"}}}
- id=2 {"product":{"name":"Oranges","customer":{"bill":6.0,"name":"Huge"}}}
- id=3 {"product":{"name":"Apples","customer":{"bill":2.0,"name":"Good"}}}
- id=4 {"product":{"name":"Oranges","customer":{"bill":9.0,"name":"Bad"}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement