elasticsearch-api 6.8.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (334) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -1
  3. data/LICENSE.txt +199 -10
  4. data/README.md +3 -3
  5. data/Rakefile +23 -6
  6. data/elasticsearch-api.gemspec +77 -43
  7. data/lib/elasticsearch/api/actions/abort_benchmark.rb +17 -4
  8. data/lib/elasticsearch/api/actions/benchmark.rb +18 -5
  9. data/lib/elasticsearch/api/actions/bulk.rb +18 -7
  10. data/lib/elasticsearch/api/actions/cat/aliases.rb +25 -11
  11. data/lib/elasticsearch/api/actions/cat/allocation.rb +26 -12
  12. data/lib/elasticsearch/api/actions/cat/count.rb +25 -11
  13. data/lib/elasticsearch/api/actions/cat/fielddata.rb +23 -11
  14. data/lib/elasticsearch/api/actions/cat/health.rb +26 -12
  15. data/lib/elasticsearch/api/actions/cat/help.rb +18 -6
  16. data/lib/elasticsearch/api/actions/cat/indices.rb +28 -13
  17. data/lib/elasticsearch/api/actions/cat/master.rb +25 -11
  18. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +19 -7
  19. data/lib/elasticsearch/api/actions/cat/nodes.rb +25 -11
  20. data/lib/elasticsearch/api/actions/cat/params_registry.rb +19 -6
  21. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +25 -11
  22. data/lib/elasticsearch/api/actions/cat/plugins.rb +21 -8
  23. data/lib/elasticsearch/api/actions/cat/recovery.rb +26 -11
  24. data/lib/elasticsearch/api/actions/cat/repositories.rb +18 -7
  25. data/lib/elasticsearch/api/actions/cat/segments.rb +22 -10
  26. data/lib/elasticsearch/api/actions/cat/shards.rb +26 -12
  27. data/lib/elasticsearch/api/actions/cat/snapshots.rb +19 -9
  28. data/lib/elasticsearch/api/actions/cat/tasks.rb +20 -6
  29. data/lib/elasticsearch/api/actions/cat/templates.rb +21 -8
  30. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +33 -16
  31. data/lib/elasticsearch/api/actions/clear_scroll.rb +19 -15
  32. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +20 -6
  33. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +19 -7
  34. data/lib/elasticsearch/api/actions/cluster/health.rb +35 -13
  35. data/lib/elasticsearch/api/actions/cluster/params_registry.rb +19 -6
  36. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +20 -6
  37. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +19 -8
  38. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +17 -10
  39. data/lib/elasticsearch/api/actions/cluster/reroute.rb +23 -10
  40. data/lib/elasticsearch/api/actions/cluster/state.rb +28 -18
  41. data/lib/elasticsearch/api/actions/cluster/stats.rb +21 -16
  42. data/lib/elasticsearch/api/actions/count.rb +18 -4
  43. data/lib/elasticsearch/api/actions/create.rb +16 -3
  44. data/lib/elasticsearch/api/actions/delete.rb +24 -19
  45. data/lib/elasticsearch/api/actions/delete_by_query.rb +18 -5
  46. data/lib/elasticsearch/api/actions/{delete_by_query_rethrottle.rb → delete_by_rethrottle.rb} +18 -5
  47. data/lib/elasticsearch/api/actions/delete_script.rb +18 -5
  48. data/lib/elasticsearch/api/actions/exists.rb +18 -6
  49. data/lib/elasticsearch/api/actions/exists_source.rb +16 -3
  50. data/lib/elasticsearch/api/actions/explain.rb +30 -10
  51. data/lib/elasticsearch/api/actions/field_caps.rb +18 -6
  52. data/lib/elasticsearch/api/actions/get.rb +20 -6
  53. data/lib/elasticsearch/api/actions/get_script.rb +22 -9
  54. data/lib/elasticsearch/api/actions/get_source.rb +32 -10
  55. data/lib/elasticsearch/api/actions/index.rb +37 -17
  56. data/lib/elasticsearch/api/actions/indices/analyze.rb +32 -6
  57. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +20 -8
  58. data/lib/elasticsearch/api/actions/indices/close.rb +31 -11
  59. data/lib/elasticsearch/api/actions/indices/create.rb +36 -24
  60. data/lib/elasticsearch/api/actions/indices/delete.rb +21 -7
  61. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +20 -8
  62. data/lib/elasticsearch/api/actions/indices/delete_template.rb +18 -6
  63. data/lib/elasticsearch/api/actions/indices/exists.rb +32 -12
  64. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +30 -10
  65. data/lib/elasticsearch/api/actions/indices/exists_template.rb +20 -8
  66. data/lib/elasticsearch/api/actions/indices/exists_type.rb +31 -10
  67. data/lib/elasticsearch/api/actions/indices/flush.rb +26 -9
  68. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +18 -5
  69. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +18 -5
  70. data/lib/elasticsearch/api/actions/indices/freeze.rb +1 -4
  71. data/lib/elasticsearch/api/actions/indices/get.rb +21 -7
  72. data/lib/elasticsearch/api/actions/indices/get_alias.rb +18 -5
  73. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +21 -7
  74. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +21 -8
  75. data/lib/elasticsearch/api/actions/indices/get_settings.rb +18 -5
  76. data/lib/elasticsearch/api/actions/indices/get_template.rb +21 -7
  77. data/lib/elasticsearch/api/actions/indices/open.rb +18 -5
  78. data/lib/elasticsearch/api/actions/indices/params_registry.rb +19 -6
  79. data/lib/elasticsearch/api/actions/indices/put_alias.rb +18 -5
  80. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +23 -11
  81. data/lib/elasticsearch/api/actions/indices/put_settings.rb +18 -5
  82. data/lib/elasticsearch/api/actions/indices/put_template.rb +21 -7
  83. data/lib/elasticsearch/api/actions/indices/recovery.rb +19 -6
  84. data/lib/elasticsearch/api/actions/indices/refresh.rb +18 -5
  85. data/lib/elasticsearch/api/actions/indices/rollover.rb +21 -7
  86. data/lib/elasticsearch/api/actions/indices/segments.rb +18 -5
  87. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +18 -5
  88. data/lib/elasticsearch/api/actions/indices/shrink.rb +18 -7
  89. data/lib/elasticsearch/api/actions/indices/split.rb +19 -9
  90. data/lib/elasticsearch/api/actions/indices/stats.rb +18 -5
  91. data/lib/elasticsearch/api/actions/indices/unfreeze.rb +0 -4
  92. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +18 -5
  93. data/lib/elasticsearch/api/actions/indices/upgrade.rb +18 -5
  94. data/lib/elasticsearch/api/actions/indices/validate_query.rb +18 -5
  95. data/lib/elasticsearch/api/actions/info.rb +16 -9
  96. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +18 -5
  97. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +20 -8
  98. data/lib/elasticsearch/api/actions/ingest/params_registry.rb +19 -6
  99. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +0 -4
  100. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +18 -5
  101. data/lib/elasticsearch/api/actions/ingest/simulate.rb +22 -9
  102. data/lib/elasticsearch/api/actions/mget.rb +17 -4
  103. data/lib/elasticsearch/api/actions/msearch.rb +21 -7
  104. data/lib/elasticsearch/api/actions/msearch_template.rb +21 -6
  105. data/lib/elasticsearch/api/actions/mtermvectors.rb +18 -5
  106. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +20 -5
  107. data/lib/elasticsearch/api/actions/nodes/info.rb +44 -11
  108. data/lib/elasticsearch/api/actions/nodes/params_registry.rb +19 -6
  109. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +19 -12
  110. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +17 -4
  111. data/lib/elasticsearch/api/actions/nodes/stats.rb +18 -5
  112. data/lib/elasticsearch/api/actions/nodes/usage.rb +3 -7
  113. data/lib/elasticsearch/api/actions/params_registry.rb +19 -6
  114. data/lib/elasticsearch/api/actions/ping.rb +16 -9
  115. data/lib/elasticsearch/api/actions/put_script.rb +18 -6
  116. data/lib/elasticsearch/api/actions/rank_eval.rb +17 -4
  117. data/lib/elasticsearch/api/actions/reindex.rb +19 -5
  118. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +17 -4
  119. data/lib/elasticsearch/api/actions/remote/info.rb +16 -3
  120. data/lib/elasticsearch/api/actions/render_search_template.rb +18 -5
  121. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +16 -9
  122. data/lib/elasticsearch/api/actions/scroll.rb +19 -6
  123. data/lib/elasticsearch/api/actions/search.rb +72 -39
  124. data/lib/elasticsearch/api/actions/search_shards.rb +31 -11
  125. data/lib/elasticsearch/api/actions/search_template.rb +21 -6
  126. data/lib/elasticsearch/api/actions/snapshot/create.rb +20 -6
  127. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +18 -5
  128. data/lib/elasticsearch/api/actions/snapshot/delete.rb +20 -7
  129. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +19 -5
  130. data/lib/elasticsearch/api/actions/snapshot/get.rb +21 -7
  131. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +23 -7
  132. data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +19 -6
  133. data/lib/elasticsearch/api/actions/snapshot/restore.rb +18 -5
  134. data/lib/elasticsearch/api/actions/snapshot/status.rb +23 -8
  135. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +18 -5
  136. data/lib/elasticsearch/api/actions/tasks/cancel.rb +18 -5
  137. data/lib/elasticsearch/api/actions/tasks/get.rb +18 -5
  138. data/lib/elasticsearch/api/actions/tasks/list.rb +18 -5
  139. data/lib/elasticsearch/api/actions/tasks/params_registry.rb +19 -6
  140. data/lib/elasticsearch/api/actions/termvectors.rb +33 -18
  141. data/lib/elasticsearch/api/actions/update.rb +61 -26
  142. data/lib/elasticsearch/api/actions/update_by_query.rb +18 -5
  143. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +16 -3
  144. data/lib/elasticsearch/api/namespace/cat.rb +16 -3
  145. data/lib/elasticsearch/api/namespace/cluster.rb +16 -3
  146. data/lib/elasticsearch/api/namespace/common.rb +16 -3
  147. data/lib/elasticsearch/api/namespace/indices.rb +16 -3
  148. data/lib/elasticsearch/api/namespace/ingest.rb +16 -3
  149. data/lib/elasticsearch/api/namespace/nodes.rb +16 -3
  150. data/lib/elasticsearch/api/namespace/remote.rb +16 -3
  151. data/lib/elasticsearch/api/namespace/snapshot.rb +16 -3
  152. data/lib/elasticsearch/api/namespace/tasks.rb +16 -3
  153. data/lib/elasticsearch/api/utils.rb +16 -3
  154. data/lib/elasticsearch/api/version.rb +17 -4
  155. data/lib/elasticsearch/api.rb +18 -5
  156. data/lib/elasticsearch-api.rb +16 -3
  157. data/spec/elasticsearch/api/actions/abort_benchmark_spec.rb +16 -3
  158. data/spec/elasticsearch/api/actions/benchmark_spec.rb +16 -3
  159. data/spec/elasticsearch/api/actions/bulk_spec.rb +16 -3
  160. data/spec/elasticsearch/api/actions/cat/aliases_spec.rb +16 -3
  161. data/spec/elasticsearch/api/actions/cat/allocation_spec.rb +16 -3
  162. data/spec/elasticsearch/api/actions/cat/count_spec.rb +16 -3
  163. data/spec/elasticsearch/api/actions/cat/fielddata_spec.rb +16 -3
  164. data/spec/elasticsearch/api/actions/cat/health_spec.rb +16 -3
  165. data/spec/elasticsearch/api/actions/cat/help_spec.rb +16 -3
  166. data/spec/elasticsearch/api/actions/cat/indices_spec.rb +16 -3
  167. data/spec/elasticsearch/api/actions/cat/master_spec.rb +16 -3
  168. data/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb +16 -3
  169. data/spec/elasticsearch/api/actions/cat/nodes_spec.rb +16 -3
  170. data/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb +16 -3
  171. data/spec/elasticsearch/api/actions/cat/plugins_spec.rb +16 -3
  172. data/spec/elasticsearch/api/actions/cat/recovery_spec.rb +16 -3
  173. data/spec/elasticsearch/api/actions/cat/repositories_spec.rb +16 -3
  174. data/spec/elasticsearch/api/actions/cat/segments_spec.rb +33 -4
  175. data/spec/elasticsearch/api/actions/cat/shards_spec.rb +16 -3
  176. data/spec/elasticsearch/api/actions/cat/snapshot_spec.rb +16 -3
  177. data/spec/elasticsearch/api/actions/cat/tasks_spec.rb +16 -3
  178. data/spec/elasticsearch/api/actions/cat/templates_spec.rb +16 -3
  179. data/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb +16 -3
  180. data/spec/elasticsearch/api/actions/clear_scroll_spec.rb +16 -3
  181. data/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb +16 -3
  182. data/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb +16 -3
  183. data/spec/elasticsearch/api/actions/cluster/health_spec.rb +16 -3
  184. data/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb +16 -3
  185. data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +16 -3
  186. data/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb +16 -3
  187. data/spec/elasticsearch/api/actions/cluster/reroute_spec.rb +16 -3
  188. data/spec/elasticsearch/api/actions/cluster/state_spec.rb +16 -3
  189. data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +16 -20
  190. data/spec/elasticsearch/api/actions/count_spec.rb +16 -3
  191. data/spec/elasticsearch/api/actions/create_document_spec.rb +16 -3
  192. data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +16 -3
  193. data/spec/elasticsearch/api/actions/delete_document_spec.rb +16 -9
  194. data/spec/elasticsearch/api/actions/delete_script_spec.rb +16 -3
  195. data/spec/elasticsearch/api/actions/exists_document_spec.rb +16 -3
  196. data/spec/elasticsearch/api/actions/explain_document_spec.rb +17 -10
  197. data/spec/elasticsearch/api/actions/field_caps_spec.rb +16 -3
  198. data/spec/elasticsearch/api/actions/get_document_source_spec.rb +17 -4
  199. data/spec/elasticsearch/api/actions/get_document_spec.rb +17 -4
  200. data/spec/elasticsearch/api/actions/get_script_spec.rb +22 -16
  201. data/spec/elasticsearch/api/actions/hashie_spec.rb +16 -3
  202. data/spec/elasticsearch/api/actions/index_document_spec.rb +16 -9
  203. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +16 -3
  204. data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +19 -6
  205. data/spec/elasticsearch/api/actions/indices/close_spec.rb +16 -3
  206. data/spec/elasticsearch/api/actions/indices/create_spec.rb +16 -3
  207. data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +16 -3
  208. data/spec/elasticsearch/api/actions/indices/delete_spec.rb +16 -3
  209. data/spec/elasticsearch/api/actions/indices/delete_template_spec.rb +16 -3
  210. data/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb +16 -3
  211. data/spec/elasticsearch/api/actions/indices/exists_spec.rb +16 -3
  212. data/spec/elasticsearch/api/actions/indices/exists_template_spec.rb +16 -3
  213. data/spec/elasticsearch/api/actions/indices/exists_type_spec.rb +16 -3
  214. data/spec/elasticsearch/api/actions/indices/flush_spec.rb +16 -3
  215. data/spec/elasticsearch/api/actions/indices/flush_synced_spec.rb +16 -3
  216. data/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb +16 -3
  217. data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +68 -0
  218. data/spec/elasticsearch/api/actions/indices/get_alias_spec.rb +16 -3
  219. data/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb +16 -3
  220. data/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb +16 -3
  221. data/spec/elasticsearch/api/actions/indices/get_settings_spec.rb +16 -3
  222. data/spec/elasticsearch/api/actions/indices/get_spec.rb +16 -3
  223. data/spec/elasticsearch/api/actions/indices/open_spec.rb +16 -3
  224. data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +16 -3
  225. data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +16 -3
  226. data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +31 -3
  227. data/spec/elasticsearch/api/actions/indices/put_template_spec.rb +16 -3
  228. data/spec/elasticsearch/api/actions/indices/recovery_spec.rb +16 -3
  229. data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +16 -3
  230. data/spec/elasticsearch/api/actions/indices/rollover_spec.rb +16 -3
  231. data/spec/elasticsearch/api/actions/indices/segments_spec.rb +16 -3
  232. data/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb +16 -3
  233. data/spec/elasticsearch/api/actions/indices/shrink_spec.rb +16 -3
  234. data/spec/elasticsearch/api/actions/indices/split_spec.rb +16 -3
  235. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +125 -0
  236. data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +68 -0
  237. data/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb +16 -3
  238. data/spec/elasticsearch/api/actions/indices/upgrade_spec.rb +16 -3
  239. data/spec/elasticsearch/api/actions/indices/validate_query_spec.rb +16 -3
  240. data/spec/elasticsearch/api/actions/info_spec.rb +16 -3
  241. data/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb +16 -3
  242. data/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb +16 -3
  243. data/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb +16 -3
  244. data/spec/elasticsearch/api/actions/ingest/simulate_spec.rb +16 -3
  245. data/spec/elasticsearch/api/actions/json_builders_spec.rb +16 -3
  246. data/spec/elasticsearch/api/actions/mget_spec.rb +16 -3
  247. data/spec/elasticsearch/api/actions/msearch_spec.rb +16 -3
  248. data/spec/elasticsearch/api/actions/msearch_template_spec.rb +16 -3
  249. data/spec/elasticsearch/api/actions/mtermvectors_spec.rb +16 -3
  250. data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +16 -3
  251. data/spec/elasticsearch/api/actions/nodes/info_spec.rb +16 -3
  252. data/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb +16 -3
  253. data/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +16 -3
  254. data/spec/elasticsearch/api/actions/nodes/stats_spec.rb +16 -3
  255. data/spec/elasticsearch/api/actions/ping_spec.rb +16 -3
  256. data/spec/elasticsearch/api/actions/put_script_spec.rb +16 -3
  257. data/spec/elasticsearch/api/actions/reindex_spec.rb +16 -3
  258. data/spec/elasticsearch/api/actions/remote/info_spec.rb +16 -3
  259. data/spec/elasticsearch/api/actions/render_search_template_spec.rb +16 -3
  260. data/spec/elasticsearch/api/actions/scoll_spec.rb +16 -3
  261. data/spec/elasticsearch/api/actions/search_shards_spec.rb +16 -3
  262. data/spec/elasticsearch/api/actions/search_spec.rb +31 -3
  263. data/spec/elasticsearch/api/actions/search_template_spec.rb +16 -3
  264. data/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb +16 -3
  265. data/spec/elasticsearch/api/actions/snapshot/create_spec.rb +16 -3
  266. data/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb +16 -3
  267. data/spec/elasticsearch/api/actions/snapshot/delete_spec.rb +16 -3
  268. data/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb +16 -3
  269. data/spec/elasticsearch/api/actions/snapshot/get_spec.rb +16 -3
  270. data/spec/elasticsearch/api/actions/snapshot/restore_spec.rb +16 -3
  271. data/spec/elasticsearch/api/actions/snapshot/status_spec.rb +16 -3
  272. data/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb +16 -3
  273. data/spec/elasticsearch/api/actions/tasks/cancel_spec.rb +16 -3
  274. data/spec/elasticsearch/api/actions/tasks/get_spec.rb +16 -3
  275. data/spec/elasticsearch/api/actions/tasks/list_spec.rb +16 -3
  276. data/spec/elasticsearch/api/actions/termvectors_spec.rb +16 -9
  277. data/spec/elasticsearch/api/actions/update_by_query_spec.rb +16 -3
  278. data/spec/elasticsearch/api/actions/update_document_spec.rb +16 -9
  279. data/spec/elasticsearch/api/api_spec.rb +16 -3
  280. data/spec/elasticsearch/api/client_spec.rb +16 -3
  281. data/spec/elasticsearch/api/utils_spec.rb +16 -3
  282. data/spec/spec_helper.rb +16 -14
  283. data/test/integration/yaml_test_runner.rb +84 -42
  284. data/test/test_helper.rb +86 -14
  285. data/utils/Gemfile +17 -0
  286. data/utils/Thorfile +17 -0
  287. data/utils/thor/generate_api.rb +16 -3
  288. data/utils/thor/generate_source.rb +22 -6
  289. data/utils/thor/lister.rb +16 -3
  290. data/utils/thor/templates/ruby/method.erb +22 -7
  291. data/utils/thor/templates/ruby/test.erb +17 -0
  292. data/utils/thor/templates/ruby/test_helper.rb +16 -4
  293. metadata +54 -120
  294. data/lib/elasticsearch/api/actions/count_percolate.rb +0 -86
  295. data/lib/elasticsearch/api/actions/delete_template.rb +0 -25
  296. data/lib/elasticsearch/api/actions/field_stats.rb +0 -40
  297. data/lib/elasticsearch/api/actions/get_template.rb +0 -31
  298. data/lib/elasticsearch/api/actions/indices/delete_mapping.rb +0 -30
  299. data/lib/elasticsearch/api/actions/indices/delete_warmer.rb +0 -36
  300. data/lib/elasticsearch/api/actions/indices/get_aliases.rb +0 -41
  301. data/lib/elasticsearch/api/actions/indices/get_warmer.rb +0 -66
  302. data/lib/elasticsearch/api/actions/indices/optimize.rb +0 -81
  303. data/lib/elasticsearch/api/actions/indices/put_warmer.rb +0 -69
  304. data/lib/elasticsearch/api/actions/indices/seal.rb +0 -28
  305. data/lib/elasticsearch/api/actions/indices/snapshot_index.rb +0 -48
  306. data/lib/elasticsearch/api/actions/indices/status.rb +0 -67
  307. data/lib/elasticsearch/api/actions/list_benchmarks.rb +0 -31
  308. data/lib/elasticsearch/api/actions/mlt.rb +0 -134
  309. data/lib/elasticsearch/api/actions/mpercolate.rb +0 -66
  310. data/lib/elasticsearch/api/actions/percolate.rb +0 -77
  311. data/lib/elasticsearch/api/actions/put_template.rb +0 -29
  312. data/lib/elasticsearch/api/actions/search_exists.rb +0 -67
  313. data/lib/elasticsearch/api/actions/suggest.rb +0 -53
  314. data/spec/elasticsearch/api/actions/count_percolate_spec.rb +0 -21
  315. data/spec/elasticsearch/api/actions/delete_template_spec.rb +0 -21
  316. data/spec/elasticsearch/api/actions/field_stats_spec.rb +0 -21
  317. data/spec/elasticsearch/api/actions/get_template_spec.rb +0 -56
  318. data/spec/elasticsearch/api/actions/indices/delete_mapping_spec.rb +0 -81
  319. data/spec/elasticsearch/api/actions/indices/delete_warmer_spec.rb +0 -90
  320. data/spec/elasticsearch/api/actions/indices/get_aliases_spec.rb +0 -59
  321. data/spec/elasticsearch/api/actions/indices/get_template_spec.rb +0 -63
  322. data/spec/elasticsearch/api/actions/indices/get_warmer_spec.rb +0 -52
  323. data/spec/elasticsearch/api/actions/indices/optimize_spec.rb +0 -67
  324. data/spec/elasticsearch/api/actions/indices/put_warmer_spec.rb +0 -105
  325. data/spec/elasticsearch/api/actions/indices/seal_spec.rb +0 -22
  326. data/spec/elasticsearch/api/actions/indices/snapshot_index_spec.rb +0 -93
  327. data/spec/elasticsearch/api/actions/indices/status_spec.rb +0 -96
  328. data/spec/elasticsearch/api/actions/list_benchmarks_spec.rb +0 -21
  329. data/spec/elasticsearch/api/actions/mlt_spec.rb +0 -134
  330. data/spec/elasticsearch/api/actions/mpercolate_spec.rb +0 -53
  331. data/spec/elasticsearch/api/actions/put_template_spec.rb +0 -21
  332. data/spec/elasticsearch/api/actions/rank_eval_spec.rb +0 -113
  333. data/spec/elasticsearch/api/actions/search_exists_spec.rb +0 -67
  334. data/spec/elasticsearch/api/actions/suggest_spec.rb +0 -81
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
6
19
  JRUBY = defined?(JRUBY_VERSION)
@@ -10,7 +23,6 @@ require 'logger'
10
23
  require 'yaml'
11
24
  require 'active_support/inflector'
12
25
  require 'ansi'
13
- require 'turn'
14
26
 
15
27
  require 'elasticsearch'
16
28
  require 'elasticsearch/extensions/test/cluster'
@@ -20,10 +32,7 @@ require 'elasticsearch/extensions/test/profiling' unless JRUBY
20
32
  # Skip features
21
33
  skip_features = 'stash_in_path,requires_replica,headers,warnings,default_shards'
22
34
  SKIP_FEATURES = ENV.fetch('TEST_SKIP_FEATURES', skip_features)
23
-
24
- # Turn configuration
25
- ENV['ansi'] = 'false' if ENV['CI']
26
- Turn.config.format = :pretty
35
+ SKIPPED_TESTS = [ '/nodes.stats/30_discovery.yml' ]
27
36
 
28
37
  # Launch test cluster
29
38
  #
@@ -88,7 +97,7 @@ $client ||= Elasticsearch::Client.new url: url
88
97
  $helper_client ||= Elasticsearch::Client.new url: url
89
98
 
90
99
  $client.transport.logger = logger unless ENV['QUIET'] || ENV['CI']
91
- # $client.transport.tracer = tracer if ENV['CI']
100
+ $client.transport.tracer = tracer if ENV['TRACE']
92
101
 
93
102
  # Store Elasticsearch version
94
103
  #
@@ -100,40 +109,58 @@ puts '-'*80,
100
109
  '-'*80
101
110
 
102
111
  require 'test_helper'
103
- require 'test/unit'
104
- require 'shoulda/context'
105
112
 
106
- # Monkeypatch shoulda to remove "should" from test name
107
- #
108
- module Shoulda
109
- module Context
110
- class Context
111
- def create_test_from_should_hash(should)
112
- test_name = ["test:", full_name, "|", "#{should[:name]}"].flatten.join(' ').to_sym
113
-
114
- if test_methods[test_unit_class][test_name.to_s] then
115
- raise DuplicateTestError, "'#{test_name}' is defined more than once."
116
- end
113
+ class Elasticsearch::Test::YAMLTestReporter < ::MiniTest::Reporters::SpecReporter
114
+ def before_suite(suite)
115
+ puts ">>>>> #{suite.to_s} #{''.ljust(73-suite.to_s.size, '>')}" unless ENV['QUIET']
116
+ end
117
117
 
118
- test_methods[test_unit_class][test_name.to_s] = true
119
-
120
- context = self
121
- test_unit_class.send(:define_method, test_name) do
122
- @shoulda_context = context
123
- begin
124
- context.run_parent_setup_blocks(self)
125
- should[:before].bind(self).call if should[:before]
126
- context.run_current_setup_blocks(self)
127
- should[:block].bind(self).call
128
- ensure
129
- context.run_all_teardown_blocks(self)
130
- end
118
+ def after_suite(suite)
119
+ super unless ENV['QUIET']
120
+ end
121
+
122
+ def after_suites(suites, type)
123
+ time = Time.now - runner.suites_start_time
124
+
125
+ color = ( runner.errors > 0 || runner.failures > 0 ) ? :red : :green
126
+ status_line = "Finished in %.6fs, %.4f tests/s, %.4f assertions/s.\n".ansi(color) %
127
+ [time, runner.test_count / time, runner.assertion_count / time]
128
+ status_line += "#{runner.test_count} tests: #{runner.skips} skipped, #{runner.errors} errored, #{runner.failures} failed.".ansi(:bold, color)
129
+
130
+ puts '=' * 80
131
+ puts status_line
132
+ puts '-' * 80, ''
133
+
134
+ runner.test_results.each do |suite, tests|
135
+ tests.each do |test, test_runner|
136
+ next unless test_runner.result.to_s =~ /error|failure/
137
+
138
+ test_name = test_runner.test.to_s
139
+ .gsub(/^test_: /, '')
140
+ .gsub(/ should /, ' ')
141
+ .gsub(/\| .*$/, '')
142
+ .gsub(/\.\s*$/, '')
143
+ yaml_filename = test_runner.test.to_s.gsub(/.*\| (.*)\.\s*$/, '\1')
144
+
145
+ status = case test_runner.result
146
+ when :failure
147
+ "FAILURE"
148
+ when :error
149
+ "ERROR"
131
150
  end
151
+
152
+ puts status.ansi(:red) +
153
+ " [#{test_runner.suite.to_s}] ".ansi(:red, :bold) +
154
+ test_name,
155
+ "<https://github.com/elastic/elasticsearch/blob/master/rest-api-spec/src/main/resources/rest-api-spec/test/#{yaml_filename}>".ansi(:underscore),
156
+ test_runner.exception.message.ansi(:faint), ''
132
157
  end
133
158
  end
134
159
  end
135
160
  end
136
161
 
162
+ Minitest::Reporters.use! Elasticsearch::Test::YAMLTestReporter.new
163
+
137
164
  module Elasticsearch
138
165
  module YamlTestSuite
139
166
  $last_response = ''
@@ -218,7 +245,7 @@ module Elasticsearch
218
245
  def in_context(name, &block)
219
246
  klass = Class.new(YamlTestCase)
220
247
  Object::const_set "%sTest" % name.split(/\s/).map { |d| d.capitalize }.join('').gsub(/[^\w]+/, ''), klass
221
- klass.context name, &block
248
+ klass.context "[#{name.ansi(:bold)}]", &block
222
249
  end
223
250
 
224
251
  def fetch_or_return(var)
@@ -280,13 +307,13 @@ module Elasticsearch
280
307
  extend self
281
308
  end
282
309
 
283
- class YamlTestCase < ::Test::Unit::TestCase; end
310
+ class YamlTestCase < ::Minitest::Test; end
284
311
  end
285
312
  end
286
313
 
287
314
  include Elasticsearch::YamlTestSuite
288
315
 
289
- rest_api_test_source = $client.info['version']['number'] < '2' ? '../../../../tmp/elasticsearch/rest-api-spec/test' : '../../../../tmp/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/test'
316
+ rest_api_test_source = '../../../../tmp/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/test'
290
317
  PATH = Pathname(ENV.fetch('TEST_REST_API_SPEC', File.expand_path(rest_api_test_source, __FILE__)))
291
318
 
292
319
  suites = Dir.glob(PATH.join('*')).map { |d| Pathname(d) }
@@ -301,7 +328,14 @@ suites.each do |suite|
301
328
  #
302
329
  setup do
303
330
  $helper_client.indices.delete index: '_all', ignore: 404
304
- $helper_client.indices.delete_template name: '*', ignore: 404
331
+ $helper_client.indices.delete index: 'test-weird-index*', ignore: 404
332
+ $helper_client.indices.delete_template name: 'nomatch', ignore: 404
333
+ $helper_client.indices.delete_template name: 'test_2', ignore: 404
334
+ $helper_client.indices.delete_template name: 'test2', ignore: 404
335
+ $helper_client.indices.delete_template name: 'test', ignore: 404
336
+ $helper_client.indices.delete_template name: 'index_template', ignore: 404
337
+ $helper_client.indices.delete_template name: 'test_no_mappings', ignore: 404
338
+ $helper_client.indices.delete_template name: 'test_template', ignore: 404
305
339
  $helper_client.snapshot.delete repository: 'test_repo_create_1', snapshot: 'test_snapshot', ignore: 404
306
340
  $helper_client.snapshot.delete repository: 'test_repo_restore_1', snapshot: 'test_snapshot', ignore: 404
307
341
  $helper_client.snapshot.delete repository: 'test_cat_snapshots_1', snapshot: 'snap1', ignore: 404
@@ -333,13 +367,18 @@ suites.each do |suite|
333
367
  #
334
368
  teardown do
335
369
  $helper_client.indices.delete index: '_all', ignore: 404
370
+
371
+ # Wipe out cluster "transient" settings
372
+ settings = $helper_client.cluster.get_settings(flat_settings: true)['transient'].keys.reduce({}) {|s,i| s[i] = nil; s}
373
+ $helper_client.cluster.put_settings body: { transient: settings } unless settings.empty?
336
374
  end
337
375
 
338
376
  files = Dir[suite.join('*.{yml,yaml}')]
339
377
  files.each do |file|
378
+ next if SKIPPED_TESTS.any? { |test| file =~ /#{test}/ }
340
379
  begin
341
380
  tests = YAML.load_stream File.new(file)
342
- rescue Exception => e
381
+ rescue RuntimeError => e
343
382
  $stderr.puts "ERROR [#{e.class}] while loading [#{file}] file".ansi(:red)
344
383
  # raise e
345
384
  next
@@ -362,7 +401,10 @@ suites.each do |suite|
362
401
 
363
402
  tests.each do |test|
364
403
  context '' do
365
- test_name = test.keys.first.to_s + (ENV['QUIET'] ? '' : " | #{file.gsub(PATH.to_s, '').ansi(:bold)}")
404
+ yaml_file_line = File.read(file).force_encoding("UTF-8").split("\n").index {|l| l.include? test.keys.first.to_s }
405
+
406
+ l = yaml_file_line ? "#L#{yaml_file_line.to_i + 1}" : ''
407
+ test_name = test.keys.first.to_s + " | #{file.gsub(PATH.to_s, '').gsub(/^\//, '')}" + l
366
408
  actions = test.values.first
367
409
 
368
410
  if reason = Runner.skip?(actions)
@@ -433,7 +475,7 @@ suites.each do |suite|
433
475
 
434
476
  begin
435
477
  $results[test.hash] = Runner.perform_api_call(test, api, arguments)
436
- rescue Exception => e
478
+ rescue StandardError => e
437
479
  begin
438
480
  $results[test.hash] = MultiJson.load(e.message.match(/{.+}/, 1).to_s)
439
481
  rescue MultiJson::ParseError
data/test/test_helper.rb CHANGED
@@ -1,6 +1,28 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ ELASTICSEARCH_HOSTS = if hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOSTS']
19
+ hosts.split(',').map do |host|
20
+ /(http\:\/\/)?(\S+)/.match(host)[2]
21
+ end
22
+ end.freeze
23
+
24
+ TEST_HOST, TEST_PORT = ELASTICSEARCH_HOSTS.first.split(':') if ELASTICSEARCH_HOSTS
25
+
4
26
 
5
27
  RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
6
28
  JRUBY = defined?(JRUBY_VERSION)
@@ -22,18 +44,14 @@ if ENV['CI'] && !RUBY_1_8
22
44
  SimpleCov.start { add_filter "/test|test_" }
23
45
  end
24
46
 
25
- require 'test/unit'
26
- require 'shoulda-context'
27
- require 'mocha/setup'
47
+ require 'ansi'
48
+ require 'test/unit' if RUBY_1_8
49
+ require 'minitest/autorun'
50
+ require 'minitest/reporters'
51
+ require 'shoulda/context'
52
+ require 'mocha/minitest'
28
53
 
29
- unless ENV["NOTURN"] || RUBY_1_8
30
- require 'turn'
31
-
32
- if ENV['QUIET']
33
- Turn.config.format = :outline
34
- Turn.config.trace = 1
35
- end
36
- end
54
+ Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
37
55
 
38
56
  require 'require-prof' if ENV["REQUIRE_PROF"]
39
57
  require 'elasticsearch/api'
@@ -44,3 +62,57 @@ if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
44
62
  require 'elasticsearch/extensions/test/startup_shutdown'
45
63
  require 'elasticsearch/extensions/test/profiling' unless JRUBY
46
64
  end
65
+
66
+ module Minitest
67
+ module Assertions
68
+ def assert_nothing_raised(*args)
69
+ begin
70
+ line = __LINE__
71
+ yield
72
+ rescue RuntimeError => e
73
+ raise MiniTest::Assertion, "Exception raised:\n<#{e.class}>", e.backtrace
74
+ end
75
+ true
76
+ end
77
+
78
+ def assert_not_nil(object, msg=nil)
79
+ msg = message(msg) { "<#{object.inspect}> expected to not be nil" }
80
+ assert !object.nil?, msg
81
+ end
82
+
83
+ def assert_block(*msgs)
84
+ assert yield, *msgs
85
+ end
86
+
87
+ alias :assert_raise :assert_raises
88
+ end
89
+ end
90
+
91
+ module Elasticsearch
92
+ module Test
93
+ class UnitTest < ::Minitest::Test; end
94
+
95
+ class FakeClient
96
+ include Elasticsearch::API
97
+
98
+ def perform_request(method, path, params, body, headers={"Content-Type" => "application/json"})
99
+ puts "PERFORMING REQUEST:", "--> #{method.to_s.upcase} #{path} #{params} #{body} #{headers}"
100
+ FakeResponse.new(200, 'FAKE', {})
101
+ end
102
+ end
103
+
104
+ FakeResponse = Struct.new(:status, :body, :headers) do
105
+ def status
106
+ values[0] || 200
107
+ end
108
+ def body
109
+ values[1] || '{}'
110
+ end
111
+ def headers
112
+ values[2] || {}
113
+ end
114
+ end
115
+
116
+ class NotFound < StandardError; end
117
+ end
118
+ end
data/utils/Gemfile CHANGED
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  source 'https://rubygems.org'
2
19
 
3
20
  gem 'activesupport'
data/utils/Thorfile CHANGED
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require File.expand_path('./thor/generate_api')
2
19
  require File.expand_path('./thor/generate_source')
3
20
  require File.expand_path('./thor/lister')
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  require 'thor'
6
19
 
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  # encoding: UTF-8
6
19
 
@@ -34,7 +47,7 @@ module Elasticsearch
34
47
 
35
48
  __root = Pathname( File.expand_path('../../..', __FILE__) )
36
49
 
37
- desc "generate <PATH TO JSON SPEC FILES>", "Generate source code and tests from the REST API JSON specification"
50
+ desc "generate", "Generate source code and tests from the REST API JSON specification"
38
51
  method_option :language, default: 'ruby', desc: 'Programming language'
39
52
  method_option :force, type: :boolean, default: false, desc: 'Overwrite the output'
40
53
  method_option :verbose, type: :boolean, default: false, desc: 'Output more information'
@@ -50,8 +63,11 @@ module Elasticsearch
50
63
  # -- Test helper
51
64
  copy_file "templates/ruby/test_helper.rb", @output.join('test').join('test_helper.rb') if options[:language] == 'ruby'
52
65
 
53
- Dir[@input].each do |file|
54
- next if File.basename(file)[0] == '_'
66
+ files = Dir.entries(@input.to_s).reject { |f| f.start_with?('.') || f.start_with?('_') }
67
+
68
+ files.each do |filepath|
69
+ file = @input.join(filepath)
70
+
55
71
  @path = Pathname(file)
56
72
  @json = MultiJson.load( File.read(@path) )
57
73
  @spec = @json.values.first
data/utils/thor/lister.rb CHANGED
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  # encoding: UTF-8
6
19
 
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Elasticsearch
2
19
  module API
3
20
  <%- @module_namespace.each_with_index do |name, i| -%>
@@ -35,10 +52,14 @@ module Elasticsearch
35
52
  <%= ' '*(@namespace_depth+1) + "raise ArgumentError, \"Required argument 'body' missing\" unless arguments[:body]" + "\n" -%>
36
53
  <%- end -%>
37
54
  <%# Method, path, params, body -%>
55
+ <%- unless @spec['url']['params'].empty? -%>
56
+ <%= ' '*@namespace_depth %> valid_params = [
57
+ <%= ' '*(@namespace_depth+2) %><%= @spec['url']['params'].keys.map { |k| ":#{k}" }.join(",\n#{' '*(@namespace_depth+5)}") %> ]
58
+ <%- end -%>
38
59
  <%= ' '*@namespace_depth %> method = <%= @http_method %>
39
60
  <%= ' '*@namespace_depth %> path = "<%= @http_path %>"
40
61
  <%- unless @spec['url']['params'].empty? -%>
41
- <%= ' '*@namespace_depth %> params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
62
+ <%= ' '*@namespace_depth %> params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
42
63
  <%- else -%>
43
64
  <%= ' '*@namespace_depth %> params = {}
44
65
  <%- end -%>
@@ -49,12 +70,6 @@ module Elasticsearch
49
70
  <%- @namespace_depth.downto(1) do |i| -%>
50
71
  <%= ' '*(i-1) %>end
51
72
  <%- end if @namespace_depth > 0 -%>
52
-
53
- <%= ' '*@namespace_depth -%># Register this action with its valid params when the module is loaded.
54
- <%= ' '*@namespace_depth -%>#
55
- <%= ' '*@namespace_depth -%># @since 6.2.0
56
- <%= ' '*@namespace_depth -%>ParamsRegistry.register(:<%= @method_name -%>, [
57
- <%= ' '*(@namespace_depth +2) + @spec['url']['params'].keys.map { |k| ":#{k}" }.join(",\n#{' '*(@namespace_depth+5)}") %> ].freeze)
58
73
  end
59
74
  end
60
75
  end
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'test_helper'
2
19
 
3
20
  module Elasticsearch
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
6
19
 
@@ -11,7 +24,6 @@ require 'simplecov' and SimpleCov.start { add_filter "/test|test_/" } if ENV["CO
11
24
  require 'test/unit'
12
25
  require 'shoulda-context'
13
26
  require 'mocha/setup'
14
- require 'turn' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8
15
27
 
16
28
  require 'require-prof' if ENV["REQUIRE_PROF"]
17
29
  Dir[ File.expand_path('../../lib/elasticsearch/api/**/*.rb', __FILE__) ].each do |f|