Guest User

Untitled

a guest
Oct 27th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. 1) PUT goodboy
  2.  
  3. DELETE /goodboy/
  4.  
  5. 2) PUT /goodboy/
  6. {
  7. "mappings": {
  8. "logs": {
  9. "properties": {
  10. "@timestamp": {
  11. "type": "date"
  12. },
  13. "@version": {
  14. "type": "text",
  15. "fields": {
  16. "keyword": {
  17. "type": "keyword",
  18. "ignore_above": 256
  19. }
  20. }
  21. },
  22. "city": {
  23. "type": "text",
  24. "fields": {
  25. "keyword": {
  26. "type": "keyword",
  27. "ignore_above": 256
  28. }
  29. }
  30. },
  31. "cost": {
  32. "type": "long"
  33. },
  34. "floor": {
  35. "type": "long"
  36. },
  37. "location": {
  38. "type": "geo_point"
  39. },
  40. "latitude": {
  41. "type": "float"
  42. },
  43. "longitude": {
  44. "type": "float"
  45. },
  46. "name": {
  47. "type": "text",
  48. "fields": {
  49. "keyword": {
  50. "type": "keyword",
  51. "ignore_above": 256
  52. }
  53. }
  54. },
  55. "rend": {
  56. "type": "text",
  57. "fields": {
  58. "keyword": {
  59. "type": "keyword",
  60. "ignore_above": 256
  61. }
  62. }
  63. },
  64. "room": {
  65. "type": "long"
  66. },
  67. "square": {
  68. "type": "text",
  69. "fields": {
  70. "keyword": {
  71. "type": "keyword",
  72. "ignore_above": 256
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80.  
  81. 3)
  82. //////////////////в goodboy.conf////////////
  83. input {
  84. jdbc {
  85. jdbc_driver_library => "/home/a/Downloads/mysql-connector-java-5.0.8-bin.jar"
  86. jdbc_driver_class => "com.mysql.jdbc.Driver"
  87. jdbc_connection_string => "jdbc:mysql://localhost:3306/DB_testadmin2"
  88. jdbc_validate_connection => true
  89. jdbc_user => "root"
  90. jdbc_password => ""
  91. # our query
  92. statement => "select name, rend, cost, city, floor, room, square, latitude, longitude from houses inner join cities on cities.id = houses.id_city inner join rends on houses.id_rend = rends.id inner join costs on houses.id_cost = costs.id inner join squares on houses.id_square = squares.id inner join rooms on houses.id_room = rooms.id inner join floors on houses.id_floor = floors.id LIMIT 75,20"
  93. jdbc_paging_enabled => "true"
  94. jdbc_page_size => "50000"
  95. }
  96. }
  97. filter {
  98.  
  99. if [latitude] and [longitude] {
  100. mutate {
  101. add_field => [ "[location][lon]", "%{longitude}" ]
  102. add_field => [ "[location][lat]", "%{latitude}" ]
  103. }
  104. mutate {
  105. convert => [ "[location][lat]", "float" ]
  106. convert => [ "[location][lon]", "float" ]
  107. }
  108. }
  109.  
  110. }
  111. output {
  112. stdout { codec => rubydebug }
  113. elasticsearch {
  114. index => "goodboy"
  115. }
  116. }
  117. ////////////////////////////////////////////
  118.  
  119.  
  120. //////////////////////check
  121. 4) GET goodboy/_mapping
  122.  
  123. "mappings": {
  124. "log": {
  125. "properties": {
  126. "location": {
  127. "type": "geo_point"
  128. }
  129. }
  130. }
Add Comment
Please, Sign In to add comment