elasticsearch-api 7.6.0 → 7.9.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (331) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -3
  3. data/Rakefile +16 -3
  4. data/elasticsearch-api.gemspec +23 -5
  5. data/lib/elasticsearch-api.rb +16 -3
  6. data/lib/elasticsearch/api.rb +18 -4
  7. data/lib/elasticsearch/api/actions/abort_benchmark.rb +16 -3
  8. data/lib/elasticsearch/api/actions/benchmark.rb +16 -3
  9. data/lib/elasticsearch/api/actions/bulk.rb +27 -10
  10. data/lib/elasticsearch/api/actions/cat/aliases.rb +27 -8
  11. data/lib/elasticsearch/api/actions/cat/allocation.rb +23 -8
  12. data/lib/elasticsearch/api/actions/cat/count.rb +23 -8
  13. data/lib/elasticsearch/api/actions/cat/fielddata.rb +23 -8
  14. data/lib/elasticsearch/api/actions/cat/health.rb +23 -8
  15. data/lib/elasticsearch/api/actions/cat/help.rb +22 -7
  16. data/lib/elasticsearch/api/actions/cat/indices.rb +28 -9
  17. data/lib/elasticsearch/api/actions/cat/master.rb +22 -7
  18. data/lib/elasticsearch/api/actions/cat/nodeattrs.rb +22 -7
  19. data/lib/elasticsearch/api/actions/cat/nodes.rb +23 -8
  20. data/lib/elasticsearch/api/actions/cat/params_registry.rb +16 -3
  21. data/lib/elasticsearch/api/actions/cat/pending_tasks.rb +23 -8
  22. data/lib/elasticsearch/api/actions/cat/plugins.rb +22 -7
  23. data/lib/elasticsearch/api/actions/cat/recovery.rb +24 -9
  24. data/lib/elasticsearch/api/actions/cat/repositories.rb +22 -7
  25. data/lib/elasticsearch/api/actions/cat/segments.rb +23 -8
  26. data/lib/elasticsearch/api/actions/cat/shards.rb +24 -9
  27. data/lib/elasticsearch/api/actions/cat/snapshots.rb +24 -9
  28. data/lib/elasticsearch/api/actions/cat/tasks.rb +23 -8
  29. data/lib/elasticsearch/api/actions/cat/templates.rb +23 -8
  30. data/lib/elasticsearch/api/actions/cat/thread_pool.rb +24 -9
  31. data/lib/elasticsearch/api/actions/clear_scroll.rb +23 -8
  32. data/lib/elasticsearch/api/actions/cluster/allocation_explain.rb +29 -9
  33. data/lib/elasticsearch/api/actions/cluster/delete_component_template.rb +58 -0
  34. data/lib/elasticsearch/api/actions/cluster/delete_voting_config_exclusions.rb +51 -0
  35. data/lib/elasticsearch/api/actions/cluster/exists_component_template.rb +59 -0
  36. data/lib/elasticsearch/api/actions/cluster/get_component_template.rb +60 -0
  37. data/lib/elasticsearch/api/actions/cluster/get_settings.rb +22 -7
  38. data/lib/elasticsearch/api/actions/cluster/health.rb +24 -8
  39. data/lib/elasticsearch/api/actions/cluster/params_registry.rb +16 -3
  40. data/lib/elasticsearch/api/actions/cluster/pending_tasks.rb +22 -7
  41. data/lib/elasticsearch/api/actions/cluster/post_voting_config_exclusions.rb +55 -0
  42. data/lib/elasticsearch/api/actions/cluster/put_component_template.rb +62 -0
  43. data/lib/elasticsearch/api/actions/cluster/put_settings.rb +22 -7
  44. data/lib/elasticsearch/api/actions/cluster/remote_info.rb +22 -7
  45. data/lib/elasticsearch/api/actions/cluster/reroute.rb +22 -7
  46. data/lib/elasticsearch/api/actions/cluster/state.rb +24 -8
  47. data/lib/elasticsearch/api/actions/cluster/stats.rb +23 -8
  48. data/lib/elasticsearch/api/actions/count.rb +30 -20
  49. data/lib/elasticsearch/api/actions/create.rb +19 -6
  50. data/lib/elasticsearch/api/actions/dangling_indices/delete_dangling_index.rb +60 -0
  51. data/lib/elasticsearch/api/actions/dangling_indices/import_dangling_index.rb +60 -0
  52. data/lib/elasticsearch/api/actions/dangling_indices/list_dangling_indices.rb +43 -0
  53. data/lib/elasticsearch/api/actions/dangling_indices/params_registry.rb +60 -0
  54. data/lib/elasticsearch/api/actions/delete.rb +24 -8
  55. data/lib/elasticsearch/api/actions/delete_by_query.rb +25 -10
  56. data/lib/elasticsearch/api/actions/delete_by_query_rethrottle.rb +22 -7
  57. data/lib/elasticsearch/api/actions/delete_by_rethrottle.rb +16 -3
  58. data/lib/elasticsearch/api/actions/delete_script.rb +22 -7
  59. data/lib/elasticsearch/api/actions/exists.rb +23 -7
  60. data/lib/elasticsearch/api/actions/exists_source.rb +23 -7
  61. data/lib/elasticsearch/api/actions/explain.rb +32 -12
  62. data/lib/elasticsearch/api/actions/field_caps.rb +35 -14
  63. data/lib/elasticsearch/api/actions/get.rb +24 -8
  64. data/lib/elasticsearch/api/actions/get_script.rb +22 -7
  65. data/lib/elasticsearch/api/actions/get_script_context.rb +22 -7
  66. data/lib/elasticsearch/api/actions/get_script_languages.rb +22 -7
  67. data/lib/elasticsearch/api/actions/get_source.rb +23 -7
  68. data/lib/elasticsearch/api/actions/index.rb +23 -8
  69. data/lib/elasticsearch/api/actions/indices/add_block.rb +70 -0
  70. data/lib/elasticsearch/api/actions/indices/analyze.rb +32 -12
  71. data/lib/elasticsearch/api/actions/indices/clear_cache.rb +24 -9
  72. data/lib/elasticsearch/api/actions/indices/clone.rb +22 -7
  73. data/lib/elasticsearch/api/actions/indices/close.rb +23 -8
  74. data/lib/elasticsearch/api/actions/indices/create.rb +22 -7
  75. data/lib/elasticsearch/api/actions/indices/create_data_stream.rb +49 -0
  76. data/lib/elasticsearch/api/actions/indices/data_streams_stats.rb +62 -0
  77. data/lib/elasticsearch/api/actions/indices/delete.rb +24 -8
  78. data/lib/elasticsearch/api/actions/indices/delete_alias.rb +23 -8
  79. data/lib/elasticsearch/api/actions/indices/delete_data_stream.rb +48 -0
  80. data/lib/elasticsearch/api/actions/indices/delete_index_template.rb +58 -0
  81. data/lib/elasticsearch/api/actions/indices/delete_template.rb +23 -8
  82. data/lib/elasticsearch/api/actions/indices/exists.rb +23 -8
  83. data/lib/elasticsearch/api/actions/indices/exists_alias.rb +24 -9
  84. data/lib/elasticsearch/api/actions/indices/exists_index_template.rb +61 -0
  85. data/lib/elasticsearch/api/actions/indices/exists_template.rb +22 -7
  86. data/lib/elasticsearch/api/actions/indices/exists_type.rb +23 -8
  87. data/lib/elasticsearch/api/actions/indices/flush.rb +24 -8
  88. data/lib/elasticsearch/api/actions/indices/flush_synced.rb +24 -8
  89. data/lib/elasticsearch/api/actions/indices/forcemerge.rb +24 -9
  90. data/lib/elasticsearch/api/actions/indices/freeze.rb +17 -0
  91. data/lib/elasticsearch/api/actions/indices/get.rb +23 -8
  92. data/lib/elasticsearch/api/actions/indices/get_alias.rb +24 -9
  93. data/lib/elasticsearch/api/actions/indices/get_data_stream.rb +50 -0
  94. data/lib/elasticsearch/api/actions/indices/get_field_mapping.rb +24 -9
  95. data/lib/elasticsearch/api/actions/indices/get_index_template.rb +62 -0
  96. data/lib/elasticsearch/api/actions/indices/get_mapping.rb +25 -10
  97. data/lib/elasticsearch/api/actions/indices/get_settings.rb +24 -9
  98. data/lib/elasticsearch/api/actions/indices/get_template.rb +23 -8
  99. data/lib/elasticsearch/api/actions/indices/get_upgrade.rb +24 -8
  100. data/lib/elasticsearch/api/actions/indices/open.rb +23 -8
  101. data/lib/elasticsearch/api/actions/indices/params_registry.rb +16 -3
  102. data/lib/elasticsearch/api/actions/indices/put_alias.rb +23 -8
  103. data/lib/elasticsearch/api/actions/indices/put_index_template.rb +62 -0
  104. data/lib/elasticsearch/api/actions/indices/put_mapping.rb +28 -10
  105. data/lib/elasticsearch/api/actions/indices/put_settings.rb +24 -9
  106. data/lib/elasticsearch/api/actions/indices/put_template.rb +22 -7
  107. data/lib/elasticsearch/api/actions/indices/recovery.rb +23 -8
  108. data/lib/elasticsearch/api/actions/indices/refresh.rb +24 -8
  109. data/lib/elasticsearch/api/actions/indices/resolve_index.rb +58 -0
  110. data/lib/elasticsearch/api/actions/indices/rollover.rb +23 -8
  111. data/lib/elasticsearch/api/actions/indices/segments.rb +24 -9
  112. data/lib/elasticsearch/api/actions/indices/shard_stores.rb +24 -8
  113. data/lib/elasticsearch/api/actions/indices/shrink.rb +22 -7
  114. data/lib/elasticsearch/api/actions/indices/simulate_index_template.rb +61 -0
  115. data/lib/elasticsearch/api/actions/indices/simulate_template.rb +63 -0
  116. data/lib/elasticsearch/api/actions/indices/split.rb +22 -7
  117. data/lib/elasticsearch/api/actions/indices/stats.rb +23 -8
  118. data/lib/elasticsearch/api/actions/indices/unfreeze.rb +17 -0
  119. data/lib/elasticsearch/api/actions/indices/update_aliases.rb +22 -7
  120. data/lib/elasticsearch/api/actions/indices/upgrade.rb +24 -9
  121. data/lib/elasticsearch/api/actions/indices/validate_query.rb +35 -15
  122. data/lib/elasticsearch/api/actions/info.rb +22 -7
  123. data/lib/elasticsearch/api/actions/ingest/delete_pipeline.rb +22 -7
  124. data/lib/elasticsearch/api/actions/ingest/get_pipeline.rb +23 -8
  125. data/lib/elasticsearch/api/actions/ingest/params_registry.rb +16 -3
  126. data/lib/elasticsearch/api/actions/ingest/processor_grok.rb +22 -7
  127. data/lib/elasticsearch/api/actions/ingest/put_pipeline.rb +22 -7
  128. data/lib/elasticsearch/api/actions/ingest/simulate.rb +24 -9
  129. data/lib/elasticsearch/api/actions/mget.rb +24 -9
  130. data/lib/elasticsearch/api/actions/msearch.rb +27 -11
  131. data/lib/elasticsearch/api/actions/msearch_template.rb +26 -10
  132. data/lib/elasticsearch/api/actions/mtermvectors.rb +35 -14
  133. data/lib/elasticsearch/api/actions/nodes/hot_threads.rb +23 -8
  134. data/lib/elasticsearch/api/actions/nodes/info.rb +23 -8
  135. data/lib/elasticsearch/api/actions/nodes/params_registry.rb +16 -3
  136. data/lib/elasticsearch/api/actions/nodes/reload_secure_settings.rb +25 -9
  137. data/lib/elasticsearch/api/actions/nodes/shutdown.rb +16 -3
  138. data/lib/elasticsearch/api/actions/nodes/stats.rb +24 -9
  139. data/lib/elasticsearch/api/actions/nodes/usage.rb +23 -8
  140. data/lib/elasticsearch/api/actions/params_registry.rb +16 -3
  141. data/lib/elasticsearch/api/actions/ping.rb +22 -7
  142. data/lib/elasticsearch/api/actions/put_script.rb +23 -8
  143. data/lib/elasticsearch/api/actions/rank_eval.rb +25 -9
  144. data/lib/elasticsearch/api/actions/reindex.rb +23 -8
  145. data/lib/elasticsearch/api/actions/reindex_rethrottle.rb +22 -7
  146. data/lib/elasticsearch/api/actions/remote/info.rb +16 -3
  147. data/lib/elasticsearch/api/actions/render_search_template.rb +32 -12
  148. data/lib/elasticsearch/api/actions/scripts_painless_execute.rb +29 -9
  149. data/lib/elasticsearch/api/actions/scroll.rb +32 -12
  150. data/lib/elasticsearch/api/actions/search.rb +36 -16
  151. data/lib/elasticsearch/api/actions/search_shards.rb +24 -8
  152. data/lib/elasticsearch/api/actions/search_template.rb +25 -10
  153. data/lib/elasticsearch/api/actions/snapshot/cleanup_repository.rb +23 -9
  154. data/lib/elasticsearch/api/actions/snapshot/create.rb +22 -7
  155. data/lib/elasticsearch/api/actions/snapshot/create_repository.rb +22 -7
  156. data/lib/elasticsearch/api/actions/snapshot/delete.rb +23 -8
  157. data/lib/elasticsearch/api/actions/snapshot/delete_repository.rb +24 -9
  158. data/lib/elasticsearch/api/actions/snapshot/get.rb +23 -8
  159. data/lib/elasticsearch/api/actions/snapshot/get_repository.rb +24 -9
  160. data/lib/elasticsearch/api/actions/snapshot/params_registry.rb +16 -3
  161. data/lib/elasticsearch/api/actions/snapshot/restore.rb +22 -7
  162. data/lib/elasticsearch/api/actions/snapshot/status.rb +24 -9
  163. data/lib/elasticsearch/api/actions/snapshot/verify_repository.rb +22 -7
  164. data/lib/elasticsearch/api/actions/tasks/cancel.rb +26 -9
  165. data/lib/elasticsearch/api/actions/tasks/get.rb +22 -7
  166. data/lib/elasticsearch/api/actions/tasks/list.rb +22 -7
  167. data/lib/elasticsearch/api/actions/tasks/params_registry.rb +16 -3
  168. data/lib/elasticsearch/api/actions/termvectors.rb +28 -8
  169. data/lib/elasticsearch/api/actions/update.rb +24 -9
  170. data/lib/elasticsearch/api/actions/update_by_query.rb +25 -10
  171. data/lib/elasticsearch/api/actions/update_by_query_rethrottle.rb +22 -7
  172. data/lib/elasticsearch/api/namespace/cat.rb +16 -4
  173. data/lib/elasticsearch/api/namespace/cluster.rb +16 -3
  174. data/lib/elasticsearch/api/namespace/common.rb +16 -3
  175. data/lib/elasticsearch/api/namespace/dangling_indices.rb +35 -0
  176. data/lib/elasticsearch/api/namespace/indices.rb +16 -3
  177. data/lib/elasticsearch/api/namespace/ingest.rb +16 -3
  178. data/lib/elasticsearch/api/namespace/nodes.rb +16 -3
  179. data/lib/elasticsearch/api/namespace/remote.rb +16 -3
  180. data/lib/elasticsearch/api/namespace/snapshot.rb +16 -3
  181. data/lib/elasticsearch/api/namespace/tasks.rb +16 -3
  182. data/lib/elasticsearch/api/utils.rb +16 -3
  183. data/lib/elasticsearch/api/version.rb +17 -4
  184. data/spec/elasticsearch/api/actions/abort_benchmark_spec.rb +16 -3
  185. data/spec/elasticsearch/api/actions/benchmark_spec.rb +16 -3
  186. data/spec/elasticsearch/api/actions/bulk_spec.rb +16 -3
  187. data/spec/elasticsearch/api/actions/cat/aliases_spec.rb +17 -4
  188. data/spec/elasticsearch/api/actions/cat/allocation_spec.rb +17 -4
  189. data/spec/elasticsearch/api/actions/cat/count_spec.rb +17 -4
  190. data/spec/elasticsearch/api/actions/cat/fielddata_spec.rb +18 -5
  191. data/spec/elasticsearch/api/actions/cat/health_spec.rb +17 -4
  192. data/spec/elasticsearch/api/actions/cat/help_spec.rb +17 -4
  193. data/spec/elasticsearch/api/actions/cat/indices_spec.rb +17 -4
  194. data/spec/elasticsearch/api/actions/cat/master_spec.rb +17 -4
  195. data/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb +17 -4
  196. data/spec/elasticsearch/api/actions/cat/nodes_spec.rb +17 -4
  197. data/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb +17 -4
  198. data/spec/elasticsearch/api/actions/cat/plugins_spec.rb +17 -4
  199. data/spec/elasticsearch/api/actions/cat/recovery_spec.rb +17 -4
  200. data/spec/elasticsearch/api/actions/cat/repositories_spec.rb +17 -4
  201. data/spec/elasticsearch/api/actions/cat/segments_spec.rb +17 -4
  202. data/spec/elasticsearch/api/actions/cat/shards_spec.rb +17 -4
  203. data/spec/elasticsearch/api/actions/cat/snapshot_spec.rb +17 -4
  204. data/spec/elasticsearch/api/actions/cat/tasks_spec.rb +17 -4
  205. data/spec/elasticsearch/api/actions/cat/templates_spec.rb +17 -4
  206. data/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb +17 -4
  207. data/spec/elasticsearch/api/actions/clear_scroll_spec.rb +20 -5
  208. data/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb +17 -4
  209. data/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb +17 -4
  210. data/spec/elasticsearch/api/actions/cluster/health_spec.rb +19 -6
  211. data/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb +17 -4
  212. data/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb +17 -4
  213. data/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb +17 -4
  214. data/spec/elasticsearch/api/actions/cluster/reroute_spec.rb +18 -5
  215. data/spec/elasticsearch/api/actions/cluster/state_spec.rb +18 -5
  216. data/spec/elasticsearch/api/actions/cluster/stats_spec.rb +17 -4
  217. data/spec/elasticsearch/api/actions/count_spec.rb +24 -8
  218. data/spec/elasticsearch/api/actions/create_document_spec.rb +24 -7
  219. data/spec/elasticsearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb +48 -0
  220. data/spec/elasticsearch/api/actions/dangling_indices/import_dangling_indices_spec.rb +48 -0
  221. data/spec/elasticsearch/api/actions/dangling_indices/list_dangling_indices_spec.rb +36 -0
  222. data/spec/elasticsearch/api/actions/delete_by_query_spec.rb +22 -6
  223. data/spec/elasticsearch/api/actions/delete_document_spec.rb +20 -5
  224. data/spec/elasticsearch/api/actions/delete_script_spec.rb +18 -4
  225. data/spec/elasticsearch/api/actions/exists_document_spec.rb +18 -4
  226. data/spec/elasticsearch/api/actions/explain_document_spec.rb +24 -11
  227. data/spec/elasticsearch/api/actions/field_caps_spec.rb +18 -4
  228. data/spec/elasticsearch/api/actions/get_document_source_spec.rb +18 -4
  229. data/spec/elasticsearch/api/actions/get_document_spec.rb +18 -4
  230. data/spec/elasticsearch/api/actions/get_script_spec.rb +18 -4
  231. data/spec/elasticsearch/api/actions/hashie_spec.rb +16 -3
  232. data/spec/elasticsearch/api/actions/index_document_spec.rb +18 -4
  233. data/spec/elasticsearch/api/actions/indices/add_block_spec.rb +63 -0
  234. data/spec/elasticsearch/api/actions/indices/analyze_spec.rb +23 -11
  235. data/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb +1 -1
  236. data/spec/elasticsearch/api/actions/indices/clone_spec.rb +17 -4
  237. data/spec/elasticsearch/api/actions/indices/close_spec.rb +17 -4
  238. data/spec/elasticsearch/api/actions/indices/create_spec.rb +17 -4
  239. data/spec/elasticsearch/api/actions/indices/data_streams_stats_spec.rb +72 -0
  240. data/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb +17 -4
  241. data/spec/elasticsearch/api/actions/indices/delete_spec.rb +17 -4
  242. data/spec/elasticsearch/api/actions/indices/delete_template_spec.rb +17 -4
  243. data/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb +17 -4
  244. data/spec/elasticsearch/api/actions/indices/exists_spec.rb +17 -4
  245. data/spec/elasticsearch/api/actions/indices/exists_template_spec.rb +17 -4
  246. data/spec/elasticsearch/api/actions/indices/exists_type_spec.rb +17 -4
  247. data/spec/elasticsearch/api/actions/indices/flush_spec.rb +17 -4
  248. data/spec/elasticsearch/api/actions/indices/flush_synced_spec.rb +17 -4
  249. data/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb +17 -4
  250. data/spec/elasticsearch/api/actions/indices/freeze_spec.rb +17 -0
  251. data/spec/elasticsearch/api/actions/indices/get_alias_spec.rb +17 -4
  252. data/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb +17 -4
  253. data/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb +17 -4
  254. data/spec/elasticsearch/api/actions/indices/get_settings_spec.rb +17 -4
  255. data/spec/elasticsearch/api/actions/indices/get_spec.rb +17 -4
  256. data/spec/elasticsearch/api/actions/indices/open_spec.rb +17 -4
  257. data/spec/elasticsearch/api/actions/indices/put_alias_spec.rb +17 -4
  258. data/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb +17 -4
  259. data/spec/elasticsearch/api/actions/indices/put_settings_spec.rb +17 -4
  260. data/spec/elasticsearch/api/actions/indices/put_template_spec.rb +17 -4
  261. data/spec/elasticsearch/api/actions/indices/recovery_spec.rb +17 -4
  262. data/spec/elasticsearch/api/actions/indices/refresh_spec.rb +17 -4
  263. data/spec/elasticsearch/api/actions/indices/rollover_spec.rb +17 -4
  264. data/spec/elasticsearch/api/actions/indices/segments_spec.rb +17 -4
  265. data/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb +17 -4
  266. data/spec/elasticsearch/api/actions/indices/shrink_spec.rb +17 -4
  267. data/spec/elasticsearch/api/actions/indices/split_spec.rb +17 -4
  268. data/spec/elasticsearch/api/actions/indices/stats_spec.rb +17 -4
  269. data/spec/elasticsearch/api/actions/indices/unfreeze_spec.rb +17 -0
  270. data/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb +17 -4
  271. data/spec/elasticsearch/api/actions/indices/upgrade_spec.rb +17 -4
  272. data/spec/elasticsearch/api/actions/indices/validate_query_spec.rb +23 -16
  273. data/spec/elasticsearch/api/actions/info_spec.rb +18 -4
  274. data/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb +17 -4
  275. data/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb +17 -4
  276. data/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb +17 -4
  277. data/spec/elasticsearch/api/actions/ingest/simulate_spec.rb +22 -10
  278. data/spec/elasticsearch/api/actions/json_builders_spec.rb +26 -14
  279. data/spec/elasticsearch/api/actions/mget_spec.rb +21 -8
  280. data/spec/elasticsearch/api/actions/msearch_spec.rb +21 -9
  281. data/spec/elasticsearch/api/actions/msearch_template_spec.rb +21 -9
  282. data/spec/elasticsearch/api/actions/mtermvectors_spec.rb +23 -9
  283. data/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb +17 -4
  284. data/spec/elasticsearch/api/actions/nodes/info_spec.rb +17 -4
  285. data/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb +23 -13
  286. data/spec/elasticsearch/api/actions/nodes/shutdown_spec.rb +16 -3
  287. data/spec/elasticsearch/api/actions/nodes/stats_spec.rb +17 -4
  288. data/spec/elasticsearch/api/actions/ping_spec.rb +19 -5
  289. data/spec/elasticsearch/api/actions/put_script_spec.rb +20 -5
  290. data/spec/elasticsearch/api/actions/reindex_spec.rb +19 -5
  291. data/spec/elasticsearch/api/actions/remote/info_spec.rb +16 -3
  292. data/spec/elasticsearch/api/actions/render_search_template_spec.rb +22 -7
  293. data/spec/elasticsearch/api/actions/scroll_spec.rb +21 -6
  294. data/spec/elasticsearch/api/actions/search_shards_spec.rb +19 -5
  295. data/spec/elasticsearch/api/actions/search_spec.rb +23 -9
  296. data/spec/elasticsearch/api/actions/search_template_spec.rb +21 -8
  297. data/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb +17 -4
  298. data/spec/elasticsearch/api/actions/snapshot/create_spec.rb +17 -4
  299. data/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb +17 -4
  300. data/spec/elasticsearch/api/actions/snapshot/delete_spec.rb +17 -4
  301. data/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb +17 -4
  302. data/spec/elasticsearch/api/actions/snapshot/get_spec.rb +17 -4
  303. data/spec/elasticsearch/api/actions/snapshot/restore_spec.rb +17 -4
  304. data/spec/elasticsearch/api/actions/snapshot/status_spec.rb +17 -4
  305. data/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb +17 -4
  306. data/spec/elasticsearch/api/actions/tasks/cancel_spec.rb +17 -4
  307. data/spec/elasticsearch/api/actions/tasks/get_spec.rb +17 -4
  308. data/spec/elasticsearch/api/actions/tasks/list_spec.rb +17 -4
  309. data/spec/elasticsearch/api/actions/termvectors_spec.rb +21 -9
  310. data/spec/elasticsearch/api/actions/update_by_query_spec.rb +19 -5
  311. data/spec/elasticsearch/api/actions/update_document_spec.rb +18 -4
  312. data/spec/elasticsearch/api/api_spec.rb +16 -3
  313. data/spec/elasticsearch/api/client_spec.rb +16 -3
  314. data/spec/elasticsearch/api/rest_api_yaml_spec.rb +0 -1
  315. data/spec/elasticsearch/api/utils_spec.rb +16 -3
  316. data/spec/rest_yaml_tests_helper.rb +16 -3
  317. data/spec/spec_helper.rb +22 -8
  318. data/utils/Gemfile +16 -3
  319. data/utils/thor/.rubocop.yml +2 -0
  320. data/utils/thor/generate_source.rb +38 -18
  321. data/utils/thor/generator/endpoint_specifics.rb +25 -7
  322. data/utils/thor/generator/files_helper.rb +23 -0
  323. data/utils/thor/lister.rb +16 -3
  324. data/utils/thor/templates/_documentation_top.erb +14 -3
  325. data/utils/thor/templates/_perform_request.erb +6 -5
  326. data/utils/thor/templates/method.erb +18 -4
  327. data/utils/thor/templates/test_helper.rb +16 -3
  328. metadata +45 -13
  329. data/spec/README.md +0 -61
  330. data/test/integration/yaml_test_runner.rb +0 -579
  331. data/test/test_helper.rb +0 -105
@@ -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
  module Elasticsearch
6
19
  module API
@@ -11,32 +24,35 @@ module Elasticsearch
11
24
  # @option arguments [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when unavailable (missing or closed)
12
25
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
13
26
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
14
- # (options: open,closed,none,all)
27
+ # (options: open,closed,hidden,none,all)
15
28
 
16
29
  # @option arguments [String] :search_type Search operation type
17
30
  # (options: query_then_fetch,dfs_query_then_fetch)
18
31
 
32
+ # @option arguments [Hash] :headers Custom HTTP headers
19
33
  # @option arguments [Hash] :body The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (*Required*)
20
34
  #
21
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-rank-eval.html
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-rank-eval.html
22
36
  #
23
37
  def rank_eval(arguments = {})
24
38
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
25
39
 
40
+ headers = arguments.delete(:headers) || {}
41
+
26
42
  arguments = arguments.clone
27
43
 
28
44
  _index = arguments.delete(:index)
29
45
 
30
- method = Elasticsearch::API::HTTP_GET
46
+ method = Elasticsearch::API::HTTP_POST
31
47
  path = if _index
32
48
  "#{Utils.__listify(_index)}/_rank_eval"
33
49
  else
34
50
  "_rank_eval"
35
- end
51
+ end
36
52
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
37
53
 
38
54
  body = arguments[:body]
39
- perform_request(method, path, params, body).body
55
+ perform_request(method, path, params, body, headers).body
40
56
  end
41
57
 
42
58
  # Register this action with its valid params when the module is loaded.
@@ -49,5 +65,5 @@ module Elasticsearch
49
65
  :search_type
50
66
  ].freeze)
51
67
  end
52
- end
68
+ end
53
69
  end
@@ -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
  module Elasticsearch
6
19
  module API
@@ -15,16 +28,18 @@ module Elasticsearch
15
28
  # @option arguments [Boolean] :wait_for_completion Should the request should block until the reindex is complete.
16
29
  # @option arguments [Number] :requests_per_second The throttle to set on this request in sub-requests per second. -1 means no throttle.
17
30
  # @option arguments [Time] :scroll Control how long to keep the search context alive
18
- # @option arguments [Number] :slices The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks.
31
+ # @option arguments [Number|string] :slices The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`.
19
32
  # @option arguments [Number] :max_docs Maximum number of documents to process (default: all documents)
20
-
33
+ # @option arguments [Hash] :headers Custom HTTP headers
21
34
  # @option arguments [Hash] :body The search definition using the Query DSL and the prototype for the index request. (*Required*)
22
35
  #
23
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-reindex.html
36
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-reindex.html
24
37
  #
25
38
  def reindex(arguments = {})
26
39
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
27
40
 
41
+ headers = arguments.delete(:headers) || {}
42
+
28
43
  arguments = arguments.clone
29
44
 
30
45
  method = Elasticsearch::API::HTTP_POST
@@ -32,7 +47,7 @@ module Elasticsearch
32
47
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
33
48
 
34
49
  body = arguments[:body]
35
- perform_request(method, path, params, body).body
50
+ perform_request(method, path, params, body, headers).body
36
51
  end
37
52
 
38
53
  # Register this action with its valid params when the module is loaded.
@@ -49,5 +64,5 @@ module Elasticsearch
49
64
  :max_docs
50
65
  ].freeze)
51
66
  end
52
- end
67
+ end
53
68
  end
@@ -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
  module Elasticsearch
6
19
  module API
@@ -9,13 +22,15 @@ module Elasticsearch
9
22
  #
10
23
  # @option arguments [String] :task_id The task id to rethrottle
11
24
  # @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (*Required*)
12
-
25
+ # @option arguments [Hash] :headers Custom HTTP headers
13
26
  #
14
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-reindex.html
27
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-reindex.html
15
28
  #
16
29
  def reindex_rethrottle(arguments = {})
17
30
  raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id]
18
31
 
32
+ headers = arguments.delete(:headers) || {}
33
+
19
34
  arguments = arguments.clone
20
35
 
21
36
  _task_id = arguments.delete(:task_id)
@@ -25,7 +40,7 @@ module Elasticsearch
25
40
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
26
41
 
27
42
  body = nil
28
- perform_request(method, path, params, body).body
43
+ perform_request(method, path, params, body, headers).body
29
44
  end
30
45
 
31
46
  # Register this action with its valid params when the module is loaded.
@@ -35,5 +50,5 @@ module Elasticsearch
35
50
  :requests_per_second
36
51
  ].freeze)
37
52
  end
38
- end
53
+ end
39
54
  end
@@ -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
  module Elasticsearch
6
19
  module API
@@ -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
  module Elasticsearch
6
19
  module API
@@ -8,27 +21,34 @@ module Elasticsearch
8
21
  # Allows to use the Mustache language to pre-render a search definition.
9
22
  #
10
23
  # @option arguments [String] :id The id of the stored search template
11
-
24
+ # @option arguments [Hash] :headers Custom HTTP headers
12
25
  # @option arguments [Hash] :body The search definition template and its params
13
26
  #
14
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-template.html#_validating_templates
27
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-template.html#_validating_templates
15
28
  #
16
29
  def render_search_template(arguments = {})
30
+ headers = arguments.delete(:headers) || {}
31
+
17
32
  arguments = arguments.clone
18
33
 
19
34
  _id = arguments.delete(:id)
20
35
 
21
- method = Elasticsearch::API::HTTP_GET
22
- path = if _id
23
- "_render/template/#{Utils.__listify(_id)}"
36
+ method = if arguments[:body]
37
+ Elasticsearch::API::HTTP_POST
24
38
  else
25
- "_render/template"
26
- end
39
+ Elasticsearch::API::HTTP_GET
40
+ end
41
+
42
+ path = if _id
43
+ "_render/template/#{Utils.__listify(_id)}"
44
+ else
45
+ "_render/template"
46
+ end
27
47
  params = {}
28
48
 
29
49
  body = arguments[:body]
30
- perform_request(method, path, params, body).body
50
+ perform_request(method, path, params, body, headers).body
31
51
  end
32
52
  end
33
- end
53
+ end
34
54
  end
@@ -1,27 +1,47 @@
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
  module Elasticsearch
6
19
  module API
7
20
  module Actions
8
21
  # Allows an arbitrary script to be executed and a result to be returned
9
22
  #
10
-
23
+ # @option arguments [Hash] :headers Custom HTTP headers
11
24
  # @option arguments [Hash] :body The script to execute
12
25
  #
13
- # @see https://www.elastic.co/guide/en/elasticsearch/painless/7.5/painless-execute-api.html
26
+ # @see https://www.elastic.co/guide/en/elasticsearch/painless/7.x/painless-execute-api.html
14
27
  #
15
28
  def scripts_painless_execute(arguments = {})
29
+ headers = arguments.delete(:headers) || {}
30
+
16
31
  arguments = arguments.clone
17
32
 
18
- method = Elasticsearch::API::HTTP_GET
19
- path = "_scripts/painless/_execute"
33
+ method = if arguments[:body]
34
+ Elasticsearch::API::HTTP_POST
35
+ else
36
+ Elasticsearch::API::HTTP_GET
37
+ end
38
+
39
+ path = "_scripts/painless/_execute"
20
40
  params = {}
21
41
 
22
42
  body = arguments[:body]
23
- perform_request(method, path, params, body).body
43
+ perform_request(method, path, params, body, headers).body
24
44
  end
25
45
  end
26
- end
46
+ end
27
47
  end
@@ -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
  module Elasticsearch
6
19
  module API
@@ -11,7 +24,7 @@ module Elasticsearch
11
24
  # @option arguments [Time] :scroll Specify how long a consistent view of the index should be maintained for scrolled search
12
25
  # @option arguments [String] :scroll_id The scroll ID for scrolled search
13
26
  # @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
14
-
27
+ # @option arguments [Hash] :headers Custom HTTP headers
15
28
  # @option arguments [Hash] :body The scroll ID if not passed by URL or query parameter.
16
29
  #
17
30
  # *Deprecation notice*:
@@ -19,23 +32,30 @@ module Elasticsearch
19
32
  # Deprecated since version 7.0.0
20
33
  #
21
34
  #
22
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-request-body.html#request-body-search-scroll
35
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-request-body.html#request-body-search-scroll
23
36
  #
24
37
  def scroll(arguments = {})
38
+ headers = arguments.delete(:headers) || {}
39
+
25
40
  arguments = arguments.clone
26
41
 
27
42
  _scroll_id = arguments.delete(:scroll_id)
28
43
 
29
- method = Elasticsearch::API::HTTP_GET
30
- path = if _scroll_id
31
- "_search/scroll/#{Utils.__listify(_scroll_id)}"
44
+ method = if arguments[:body]
45
+ Elasticsearch::API::HTTP_POST
32
46
  else
33
- "_search/scroll"
34
- end
47
+ Elasticsearch::API::HTTP_GET
48
+ end
49
+
50
+ path = if _scroll_id
51
+ "_search/scroll/#{Utils.__listify(_scroll_id)}"
52
+ else
53
+ "_search/scroll"
54
+ end
35
55
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
36
56
 
37
57
  body = arguments[:body]
38
- perform_request(method, path, params, body).body
58
+ perform_request(method, path, params, body, headers).body
39
59
  end
40
60
 
41
61
  # Register this action with its valid params when the module is loaded.
@@ -47,5 +67,5 @@ end
47
67
  :rest_total_hits_as_int
48
68
  ].freeze)
49
69
  end
50
- end
70
+ end
51
71
  end
@@ -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
  module Elasticsearch
6
19
  module API
@@ -24,7 +37,7 @@ module Elasticsearch
24
37
  # @option arguments [Boolean] :ignore_throttled Whether specified concrete, expanded or aliased indices should be ignored when throttled
25
38
  # @option arguments [Boolean] :allow_no_indices Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
26
39
  # @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both.
27
- # (options: open,closed,none,all)
40
+ # (options: open,closed,hidden,none,all)
28
41
 
29
42
  # @option arguments [Boolean] :lenient Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
30
43
  # @option arguments [String] :preference Specify the node or shard the operation should be performed on (default: random)
@@ -57,9 +70,9 @@ module Elasticsearch
57
70
  # @option arguments [Boolean] :request_cache Specify if request cache should be used for this request or not, defaults to index level setting
58
71
  # @option arguments [Number] :batched_reduce_size The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
59
72
  # @option arguments [Number] :max_concurrent_shard_requests The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests
60
- # @option arguments [Number] :pre_filter_shard_size A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
73
+ # @option arguments [Number] :pre_filter_shard_size A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.
61
74
  # @option arguments [Boolean] :rest_total_hits_as_int Indicates whether hits.total should be rendered as an integer or an object in the rest search response
62
-
75
+ # @option arguments [Hash] :headers Custom HTTP headers
63
76
  # @option arguments [Hash] :body The search definition using the Query DSL
64
77
  #
65
78
  # *Deprecation notice*:
@@ -67,9 +80,11 @@ module Elasticsearch
67
80
  # Deprecated since version 7.0.0
68
81
  #
69
82
  #
70
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/search-search.html
83
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-search.html
71
84
  #
72
85
  def search(arguments = {})
86
+ headers = arguments.delete(:headers) || {}
87
+
73
88
  arguments = arguments.clone
74
89
  arguments[:index] = UNDERSCORE_ALL if !arguments[:index] && arguments[:type]
75
90
 
@@ -77,18 +92,23 @@ module Elasticsearch
77
92
 
78
93
  _type = arguments.delete(:type)
79
94
 
80
- method = Elasticsearch::API::HTTP_GET
81
- path = if _index && _type
82
- "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search"
83
- elsif _index
84
- "#{Utils.__listify(_index)}/_search"
95
+ method = if arguments[:body]
96
+ Elasticsearch::API::HTTP_POST
85
97
  else
86
- "_search"
87
- end
98
+ Elasticsearch::API::HTTP_GET
99
+ end
100
+
101
+ path = if _index && _type
102
+ "#{Utils.__listify(_index)}/#{Utils.__listify(_type)}/_search"
103
+ elsif _index
104
+ "#{Utils.__listify(_index)}/_search"
105
+ else
106
+ "_search"
107
+ end
88
108
  params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
89
109
 
90
110
  body = arguments[:body]
91
- perform_request(method, path, params, body).body
111
+ perform_request(method, path, params, body, headers).body
92
112
  end
93
113
 
94
114
  # Register this action with its valid params when the module is loaded.
@@ -139,5 +159,5 @@ end
139
159
  :rest_total_hits_as_int
140
160
  ].freeze)
141
161
  end
142
- end
162
+ end
143
163
  end