Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{
  2. "type" : "jdbc",
  3. "jdbc" : {
  4. "url" : "jdbc:mysql://localhost:3306/test",
  5. "user" : "",
  6. "password" : "",
  7. "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"
  8. }
  9. }'
  10.  
  11. 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 ;
  12. +--------------+------------------+-----------------------+
  13. | product.name | product.customer | product.customer.bill |
  14. +--------------+------------------+-----------------------+
  15. | Apples | Big | 1 |
  16. | Bananas | Large | 2 |
  17. | Oranges | Huge | 6 |
  18. | Apples | Good | 2 |
  19. | Oranges | Bad | 9 |
  20. +--------------+------------------+-----------------------+
  21. 5 rows in set, 5 warnings (0.00 sec)
  22.  
  23. id=0 {"product":{"name":"Apples","customer":{"bill":1.0,"name":"Big"}}}
  24. id=1 {"product":{"name":"Bananas","customer":{"bill":2.0,"name":"Large"}}}
  25. id=2 {"product":{"name":"Oranges","customer":{"bill":6.0,"name":"Huge"}}}
  26. id=3 {"product":{"name":"Apples","customer":{"bill":2.0,"name":"Good"}}}
  27. id=4 {"product":{"name":"Oranges","customer":{"bill":9.0,"name":"Bad"}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement