@elastic/elasticsearch 7.9.0 → 7.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (374) hide show
  1. package/api/api/async_search.js +114 -0
  2. package/api/api/autoscaling.js +147 -0
  3. package/api/api/bulk.js +55 -98
  4. package/api/api/cat.js +648 -0
  5. package/api/api/ccr.js +403 -0
  6. package/api/api/clear_scroll.js +42 -69
  7. package/api/api/cluster.js +420 -0
  8. package/api/api/count.js +49 -98
  9. package/api/api/create.js +54 -92
  10. package/api/api/dangling_indices.js +115 -0
  11. package/api/api/delete.js +50 -89
  12. package/api/api/delete_by_query.js +55 -135
  13. package/api/api/delete_by_query_rethrottle.js +45 -74
  14. package/api/api/delete_script.js +41 -71
  15. package/api/api/enrich.js +173 -0
  16. package/api/api/eql.js +119 -0
  17. package/api/api/exists.js +50 -95
  18. package/api/api/exists_source.js +58 -101
  19. package/api/api/explain.js +50 -98
  20. package/api/api/field_caps.js +42 -78
  21. package/api/api/get.js +50 -95
  22. package/api/api/get_script.js +41 -70
  23. package/api/api/get_script_context.js +37 -64
  24. package/api/api/get_script_languages.js +37 -64
  25. package/api/api/get_source.js +50 -93
  26. package/api/api/graph.js +72 -0
  27. package/api/api/ilm.js +295 -0
  28. package/api/api/index.js +56 -98
  29. package/api/api/indices.js +1656 -0
  30. package/api/api/info.js +37 -64
  31. package/api/api/ingest.js +178 -0
  32. package/api/api/license.js +188 -0
  33. package/api/api/mget.js +55 -97
  34. package/api/api/migration.js +60 -0
  35. package/api/api/ml.js +1842 -0
  36. package/api/api/monitoring.js +66 -0
  37. package/api/api/msearch.js +55 -96
  38. package/api/api/msearch_template.js +55 -92
  39. package/api/api/mtermvectors.js +49 -91
  40. package/api/api/nodes.js +202 -0
  41. package/api/api/ping.js +37 -64
  42. package/api/api/put_script.js +55 -86
  43. package/api/api/rank_eval.js +46 -81
  44. package/api/api/reindex.js +41 -82
  45. package/api/api/reindex_rethrottle.js +45 -74
  46. package/api/api/render_search_template.js +42 -69
  47. package/api/api/rollup.js +278 -0
  48. package/api/api/scripts_painless_execute.js +37 -64
  49. package/api/api/scroll.js +42 -74
  50. package/api/api/search.js +49 -149
  51. package/api/api/search_shards.js +42 -78
  52. package/api/api/search_template.js +55 -103
  53. package/api/api/searchable_snapshots.js +159 -0
  54. package/api/api/security.js +805 -0
  55. package/api/api/slm.js +256 -0
  56. package/api/api/snapshot.js +363 -0
  57. package/api/api/sql.js +119 -0
  58. package/api/api/ssl.js +55 -0
  59. package/api/api/tasks.js +108 -0
  60. package/api/api/termvectors.js +52 -93
  61. package/api/api/transform.js +268 -0
  62. package/api/api/update.js +54 -102
  63. package/api/api/update_by_query.js +51 -135
  64. package/api/api/update_by_query_rethrottle.js +45 -74
  65. package/api/api/watcher.js +311 -0
  66. package/api/api/xpack.js +76 -0
  67. package/api/index.js +408 -685
  68. package/api/requestParams.d.ts +813 -813
  69. package/api/utils.js +58 -0
  70. package/index.js +49 -48
  71. package/lib/Connection.d.ts +1 -1
  72. package/lib/Connection.js +1 -0
  73. package/lib/Helpers.js +4 -3
  74. package/lib/Transport.js +31 -25
  75. package/package.json +1 -1
  76. package/api/api/async_search.delete.js +0 -78
  77. package/api/api/async_search.get.js +0 -82
  78. package/api/api/async_search.submit.js +0 -147
  79. package/api/api/autoscaling.delete_autoscaling_policy.js +0 -78
  80. package/api/api/autoscaling.get_autoscaling_decision.js +0 -72
  81. package/api/api/autoscaling.get_autoscaling_policy.js +0 -78
  82. package/api/api/autoscaling.put_autoscaling_policy.js +0 -82
  83. package/api/api/cat.aliases.js +0 -90
  84. package/api/api/cat.allocation.js +0 -91
  85. package/api/api/cat.count.js +0 -87
  86. package/api/api/cat.fielddata.js +0 -89
  87. package/api/api/cat.health.js +0 -84
  88. package/api/api/cat.help.js +0 -79
  89. package/api/api/cat.indices.js +0 -98
  90. package/api/api/cat.master.js +0 -85
  91. package/api/api/cat.ml_data_frame_analytics.js +0 -85
  92. package/api/api/cat.ml_datafeeds.js +0 -84
  93. package/api/api/cat.ml_jobs.js +0 -85
  94. package/api/api/cat.ml_trained_models.js +0 -87
  95. package/api/api/cat.nodeattrs.js +0 -85
  96. package/api/api/cat.nodes.js +0 -89
  97. package/api/api/cat.pending_tasks.js +0 -86
  98. package/api/api/cat.plugins.js +0 -85
  99. package/api/api/cat.recovery.js +0 -93
  100. package/api/api/cat.repositories.js +0 -85
  101. package/api/api/cat.segments.js +0 -88
  102. package/api/api/cat.shards.js +0 -92
  103. package/api/api/cat.snapshots.js +0 -92
  104. package/api/api/cat.tasks.js +0 -89
  105. package/api/api/cat.templates.js +0 -90
  106. package/api/api/cat.thread_pool.js +0 -92
  107. package/api/api/cat.transforms.js +0 -86
  108. package/api/api/ccr.delete_auto_follow_pattern.js +0 -78
  109. package/api/api/ccr.follow.js +0 -82
  110. package/api/api/ccr.follow_info.js +0 -78
  111. package/api/api/ccr.follow_stats.js +0 -78
  112. package/api/api/ccr.forget_follower.js +0 -82
  113. package/api/api/ccr.get_auto_follow_pattern.js +0 -77
  114. package/api/api/ccr.pause_auto_follow_pattern.js +0 -78
  115. package/api/api/ccr.pause_follow.js +0 -78
  116. package/api/api/ccr.put_auto_follow_pattern.js +0 -82
  117. package/api/api/ccr.resume_auto_follow_pattern.js +0 -78
  118. package/api/api/ccr.resume_follow.js +0 -78
  119. package/api/api/ccr.stats.js +0 -72
  120. package/api/api/ccr.unfollow.js +0 -78
  121. package/api/api/cluster.allocation_explain.js +0 -81
  122. package/api/api/cluster.delete_component_template.js +0 -86
  123. package/api/api/cluster.delete_voting_config_exclusions.js +0 -79
  124. package/api/api/cluster.exists_component_template.js +0 -86
  125. package/api/api/cluster.get_component_template.js +0 -85
  126. package/api/api/cluster.get_settings.js +0 -84
  127. package/api/api/cluster.health.js +0 -101
  128. package/api/api/cluster.pending_tasks.js +0 -81
  129. package/api/api/cluster.post_voting_config_exclusions.js +0 -82
  130. package/api/api/cluster.put_component_template.js +0 -91
  131. package/api/api/cluster.put_settings.js +0 -88
  132. package/api/api/cluster.remote_info.js +0 -77
  133. package/api/api/cluster.reroute.js +0 -86
  134. package/api/api/cluster.state.js +0 -106
  135. package/api/api/cluster.stats.js +0 -85
  136. package/api/api/dangling_indices.delete_dangling_index.js +0 -88
  137. package/api/api/dangling_indices.import_dangling_index.js +0 -88
  138. package/api/api/dangling_indices.list_dangling_indices.js +0 -77
  139. package/api/api/enrich.delete_policy.js +0 -78
  140. package/api/api/enrich.execute_policy.js +0 -78
  141. package/api/api/enrich.get_policy.js +0 -77
  142. package/api/api/enrich.put_policy.js +0 -82
  143. package/api/api/enrich.stats.js +0 -72
  144. package/api/api/eql.delete.js +0 -78
  145. package/api/api/eql.get.js +0 -80
  146. package/api/api/eql.search.js +0 -86
  147. package/api/api/graph.explore.js +0 -90
  148. package/api/api/ilm.delete_lifecycle.js +0 -78
  149. package/api/api/ilm.explain_lifecycle.js +0 -80
  150. package/api/api/ilm.get_lifecycle.js +0 -77
  151. package/api/api/ilm.get_status.js +0 -72
  152. package/api/api/ilm.move_to_step.js +0 -78
  153. package/api/api/ilm.put_lifecycle.js +0 -78
  154. package/api/api/ilm.remove_policy.js +0 -78
  155. package/api/api/ilm.retry.js +0 -78
  156. package/api/api/ilm.start.js +0 -72
  157. package/api/api/ilm.stop.js +0 -72
  158. package/api/api/indices.add_block.js +0 -102
  159. package/api/api/indices.analyze.js +0 -83
  160. package/api/api/indices.clear_cache.js +0 -93
  161. package/api/api/indices.clone.js +0 -98
  162. package/api/api/indices.close.js +0 -94
  163. package/api/api/indices.create.js +0 -90
  164. package/api/api/indices.create_data_stream.js +0 -78
  165. package/api/api/indices.data_streams_stats.js +0 -77
  166. package/api/api/indices.delete.js +0 -92
  167. package/api/api/indices.delete_alias.js +0 -101
  168. package/api/api/indices.delete_data_stream.js +0 -78
  169. package/api/api/indices.delete_index_template.js +0 -86
  170. package/api/api/indices.delete_template.js +0 -86
  171. package/api/api/indices.exists.js +0 -94
  172. package/api/api/indices.exists_alias.js +0 -95
  173. package/api/api/indices.exists_index_template.js +0 -88
  174. package/api/api/indices.exists_template.js +0 -88
  175. package/api/api/indices.exists_type.js +0 -100
  176. package/api/api/indices.flush.js +0 -91
  177. package/api/api/indices.flush_synced.js +0 -88
  178. package/api/api/indices.forcemerge.js +0 -93
  179. package/api/api/indices.freeze.js +0 -87
  180. package/api/api/indices.get.js +0 -98
  181. package/api/api/indices.get_alias.js +0 -95
  182. package/api/api/indices.get_data_stream.js +0 -77
  183. package/api/api/indices.get_field_mapping.js +0 -105
  184. package/api/api/indices.get_index_template.js +0 -87
  185. package/api/api/indices.get_mapping.js +0 -99
  186. package/api/api/indices.get_settings.js +0 -101
  187. package/api/api/indices.get_template.js +0 -89
  188. package/api/api/indices.get_upgrade.js +0 -88
  189. package/api/api/indices.open.js +0 -94
  190. package/api/api/indices.put_alias.js +0 -101
  191. package/api/api/indices.put_index_template.js +0 -91
  192. package/api/api/indices.put_mapping.js +0 -119
  193. package/api/api/indices.put_settings.js +0 -101
  194. package/api/api/indices.put_template.js +0 -93
  195. package/api/api/indices.recovery.js +0 -85
  196. package/api/api/indices.refresh.js +0 -88
  197. package/api/api/indices.reload_search_analyzers.js +0 -82
  198. package/api/api/indices.resolve_index.js +0 -85
  199. package/api/api/indices.rollover.js +0 -104
  200. package/api/api/indices.segments.js +0 -89
  201. package/api/api/indices.shard_stores.js +0 -89
  202. package/api/api/indices.shrink.js +0 -100
  203. package/api/api/indices.simulate_index_template.js +0 -87
  204. package/api/api/indices.simulate_template.js +0 -86
  205. package/api/api/indices.split.js +0 -100
  206. package/api/api/indices.stats.js +0 -104
  207. package/api/api/indices.unfreeze.js +0 -87
  208. package/api/api/indices.update_aliases.js +0 -86
  209. package/api/api/indices.upgrade.js +0 -92
  210. package/api/api/indices.validate_query.js +0 -109
  211. package/api/api/ingest.delete_pipeline.js +0 -86
  212. package/api/api/ingest.get_pipeline.js +0 -84
  213. package/api/api/ingest.processor_grok.js +0 -77
  214. package/api/api/ingest.put_pipeline.js +0 -90
  215. package/api/api/ingest.simulate.js +0 -89
  216. package/api/api/license.delete.js +0 -72
  217. package/api/api/license.get.js +0 -73
  218. package/api/api/license.get_basic_status.js +0 -72
  219. package/api/api/license.get_trial_status.js +0 -72
  220. package/api/api/license.post.js +0 -72
  221. package/api/api/license.post_start_basic.js +0 -72
  222. package/api/api/license.post_start_trial.js +0 -73
  223. package/api/api/migration.deprecations.js +0 -77
  224. package/api/api/ml.close_job.js +0 -81
  225. package/api/api/ml.delete_calendar.js +0 -78
  226. package/api/api/ml.delete_calendar_event.js +0 -88
  227. package/api/api/ml.delete_calendar_job.js +0 -88
  228. package/api/api/ml.delete_data_frame_analytics.js +0 -79
  229. package/api/api/ml.delete_datafeed.js +0 -78
  230. package/api/api/ml.delete_expired_data.js +0 -79
  231. package/api/api/ml.delete_filter.js +0 -78
  232. package/api/api/ml.delete_forecast.js +0 -91
  233. package/api/api/ml.delete_job.js +0 -79
  234. package/api/api/ml.delete_model_snapshot.js +0 -88
  235. package/api/api/ml.delete_trained_model.js +0 -78
  236. package/api/api/ml.estimate_model_memory.js +0 -78
  237. package/api/api/ml.evaluate_data_frame.js +0 -78
  238. package/api/api/ml.explain_data_frame_analytics.js +0 -77
  239. package/api/api/ml.find_file_structure.js +0 -99
  240. package/api/api/ml.flush_job.js +0 -84
  241. package/api/api/ml.forecast.js +0 -81
  242. package/api/api/ml.get_buckets.js +0 -99
  243. package/api/api/ml.get_calendar_events.js +0 -83
  244. package/api/api/ml.get_calendars.js +0 -78
  245. package/api/api/ml.get_categories.js +0 -91
  246. package/api/api/ml.get_data_frame_analytics.js +0 -80
  247. package/api/api/ml.get_data_frame_analytics_stats.js +0 -80
  248. package/api/api/ml.get_datafeed_stats.js +0 -77
  249. package/api/api/ml.get_datafeeds.js +0 -77
  250. package/api/api/ml.get_filters.js +0 -78
  251. package/api/api/ml.get_influencers.js +0 -87
  252. package/api/api/ml.get_job_stats.js +0 -77
  253. package/api/api/ml.get_jobs.js +0 -77
  254. package/api/api/ml.get_model_snapshots.js +0 -94
  255. package/api/api/ml.get_overall_buckets.js +0 -88
  256. package/api/api/ml.get_records.js +0 -87
  257. package/api/api/ml.get_trained_models.js +0 -86
  258. package/api/api/ml.get_trained_models_stats.js +0 -80
  259. package/api/api/ml.info.js +0 -72
  260. package/api/api/ml.open_job.js +0 -78
  261. package/api/api/ml.post_calendar_events.js +0 -82
  262. package/api/api/ml.post_data.js +0 -84
  263. package/api/api/ml.preview_datafeed.js +0 -78
  264. package/api/api/ml.put_calendar.js +0 -78
  265. package/api/api/ml.put_calendar_job.js +0 -88
  266. package/api/api/ml.put_data_frame_analytics.js +0 -82
  267. package/api/api/ml.put_datafeed.js +0 -88
  268. package/api/api/ml.put_filter.js +0 -82
  269. package/api/api/ml.put_job.js +0 -82
  270. package/api/api/ml.put_trained_model.js +0 -82
  271. package/api/api/ml.revert_model_snapshot.js +0 -88
  272. package/api/api/ml.set_upgrade_mode.js +0 -73
  273. package/api/api/ml.start_data_frame_analytics.js +0 -78
  274. package/api/api/ml.start_datafeed.js +0 -80
  275. package/api/api/ml.stop_data_frame_analytics.js +0 -81
  276. package/api/api/ml.stop_datafeed.js +0 -81
  277. package/api/api/ml.update_data_frame_analytics.js +0 -82
  278. package/api/api/ml.update_datafeed.js +0 -88
  279. package/api/api/ml.update_filter.js +0 -82
  280. package/api/api/ml.update_job.js +0 -82
  281. package/api/api/ml.update_model_snapshot.js +0 -92
  282. package/api/api/ml.validate.js +0 -78
  283. package/api/api/ml.validate_detector.js +0 -78
  284. package/api/api/monitoring.bulk.js +0 -87
  285. package/api/api/nodes.hot_threads.js +0 -98
  286. package/api/api/nodes.info.js +0 -91
  287. package/api/api/nodes.reload_secure_settings.js +0 -83
  288. package/api/api/nodes.stats.js +0 -105
  289. package/api/api/nodes.usage.js +0 -89
  290. package/api/api/rollup.delete_job.js +0 -78
  291. package/api/api/rollup.get_jobs.js +0 -77
  292. package/api/api/rollup.get_rollup_caps.js +0 -77
  293. package/api/api/rollup.get_rollup_index_caps.js +0 -78
  294. package/api/api/rollup.put_job.js +0 -82
  295. package/api/api/rollup.rollup_search.js +0 -95
  296. package/api/api/rollup.start_job.js +0 -78
  297. package/api/api/rollup.stop_job.js +0 -80
  298. package/api/api/searchable_snapshots.clear_cache.js +0 -83
  299. package/api/api/searchable_snapshots.mount.js +0 -94
  300. package/api/api/searchable_snapshots.repository_stats.js +0 -78
  301. package/api/api/searchable_snapshots.stats.js +0 -77
  302. package/api/api/security.authenticate.js +0 -72
  303. package/api/api/security.change_password.js +0 -83
  304. package/api/api/security.clear_cached_privileges.js +0 -78
  305. package/api/api/security.clear_cached_realms.js +0 -78
  306. package/api/api/security.clear_cached_roles.js +0 -78
  307. package/api/api/security.create_api_key.js +0 -78
  308. package/api/api/security.delete_privileges.js +0 -88
  309. package/api/api/security.delete_role.js +0 -78
  310. package/api/api/security.delete_role_mapping.js +0 -78
  311. package/api/api/security.delete_user.js +0 -78
  312. package/api/api/security.disable_user.js +0 -78
  313. package/api/api/security.enable_user.js +0 -78
  314. package/api/api/security.get_api_key.js +0 -77
  315. package/api/api/security.get_builtin_privileges.js +0 -72
  316. package/api/api/security.get_privileges.js +0 -86
  317. package/api/api/security.get_role.js +0 -77
  318. package/api/api/security.get_role_mapping.js +0 -77
  319. package/api/api/security.get_token.js +0 -78
  320. package/api/api/security.get_user.js +0 -77
  321. package/api/api/security.get_user_privileges.js +0 -72
  322. package/api/api/security.has_privileges.js +0 -83
  323. package/api/api/security.invalidate_api_key.js +0 -78
  324. package/api/api/security.invalidate_token.js +0 -78
  325. package/api/api/security.put_privileges.js +0 -78
  326. package/api/api/security.put_role.js +0 -82
  327. package/api/api/security.put_role_mapping.js +0 -82
  328. package/api/api/security.put_user.js +0 -82
  329. package/api/api/slm.delete_lifecycle.js +0 -78
  330. package/api/api/slm.execute_lifecycle.js +0 -78
  331. package/api/api/slm.execute_retention.js +0 -72
  332. package/api/api/slm.get_lifecycle.js +0 -77
  333. package/api/api/slm.get_stats.js +0 -72
  334. package/api/api/slm.get_status.js +0 -72
  335. package/api/api/slm.put_lifecycle.js +0 -78
  336. package/api/api/slm.start.js +0 -72
  337. package/api/api/slm.stop.js +0 -72
  338. package/api/api/snapshot.cleanup_repository.js +0 -86
  339. package/api/api/snapshot.create.js +0 -97
  340. package/api/api/snapshot.create_repository.js +0 -91
  341. package/api/api/snapshot.delete.js +0 -95
  342. package/api/api/snapshot.delete_repository.js +0 -86
  343. package/api/api/snapshot.get.js +0 -98
  344. package/api/api/snapshot.get_repository.js +0 -85
  345. package/api/api/snapshot.restore.js +0 -97
  346. package/api/api/snapshot.status.js +0 -95
  347. package/api/api/snapshot.verify_repository.js +0 -86
  348. package/api/api/sql.clear_cursor.js +0 -78
  349. package/api/api/sql.query.js +0 -78
  350. package/api/api/sql.translate.js +0 -78
  351. package/api/api/ssl.certificates.js +0 -72
  352. package/api/api/tasks.cancel.js +0 -88
  353. package/api/api/tasks.get.js +0 -86
  354. package/api/api/tasks.list.js +0 -87
  355. package/api/api/transform.delete_transform.js +0 -78
  356. package/api/api/transform.get_transform.js +0 -79
  357. package/api/api/transform.get_transform_stats.js +0 -80
  358. package/api/api/transform.preview_transform.js +0 -78
  359. package/api/api/transform.put_transform.js +0 -82
  360. package/api/api/transform.start_transform.js +0 -78
  361. package/api/api/transform.stop_transform.js +0 -84
  362. package/api/api/transform.update_transform.js +0 -82
  363. package/api/api/watcher.ack_watch.js +0 -89
  364. package/api/api/watcher.activate_watch.js +0 -78
  365. package/api/api/watcher.deactivate_watch.js +0 -78
  366. package/api/api/watcher.delete_watch.js +0 -78
  367. package/api/api/watcher.execute_watch.js +0 -77
  368. package/api/api/watcher.get_watch.js +0 -78
  369. package/api/api/watcher.put_watch.js +0 -82
  370. package/api/api/watcher.start.js +0 -72
  371. package/api/api/watcher.stats.js +0 -78
  372. package/api/api/watcher.stop.js +0 -72
  373. package/api/api/xpack.info.js +0 -73
  374. package/api/api/xpack.usage.js +0 -72
@@ -0,0 +1,420 @@
1
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ 'use strict'
21
+
22
+ /* eslint camelcase: 0 */
23
+ /* eslint no-unused-vars: 0 */
24
+
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['include_yes_decisions', 'include_disk_info', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'master_timeout', 'wait_for_removal', 'local', 'flat_settings', 'include_defaults', 'expand_wildcards', 'level', 'wait_for_active_shards', 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', 'node_ids', 'node_names', 'create', 'dry_run', 'explain', 'retry_failed', 'metric', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices']
27
+ const snakeCase = { includeYesDecisions: 'include_yes_decisions', includeDiskInfo: 'include_disk_info', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForRemoval: 'wait_for_removal', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', expandWildcards: 'expand_wildcards', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', nodeIds: 'node_ids', nodeNames: 'node_names', dryRun: 'dry_run', retryFailed: 'retry_failed', waitForMetadataVersion: 'wait_for_metadata_version', waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices' }
28
+
29
+ function ClusterApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ var { method, body, ...querystring } = params
38
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
39
+
40
+ var path = ''
41
+ if (method == null) method = body == null ? 'GET' : 'POST'
42
+ path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain'
43
+
44
+ // build request object
45
+ const request = {
46
+ method,
47
+ path,
48
+ body: body || '',
49
+ querystring
50
+ }
51
+
52
+ return this.transport.request(request, options, callback)
53
+ }
54
+
55
+ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi (params, options, callback) {
56
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
57
+
58
+ // check required parameters
59
+ if (params['name'] == null) {
60
+ const err = new this[kConfigurationError]('Missing required parameter: name')
61
+ return handleError(err, callback)
62
+ }
63
+
64
+ var { method, body, name, ...querystring } = params
65
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+
67
+ var path = ''
68
+ if (method == null) method = 'DELETE'
69
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
70
+
71
+ // build request object
72
+ const request = {
73
+ method,
74
+ path,
75
+ body: body || '',
76
+ querystring
77
+ }
78
+
79
+ return this.transport.request(request, options, callback)
80
+ }
81
+
82
+ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi (params, options, callback) {
83
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
84
+
85
+ var { method, body, ...querystring } = params
86
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
87
+
88
+ var path = ''
89
+ if (method == null) method = 'DELETE'
90
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
91
+
92
+ // build request object
93
+ const request = {
94
+ method,
95
+ path,
96
+ body: body || '',
97
+ querystring
98
+ }
99
+
100
+ return this.transport.request(request, options, callback)
101
+ }
102
+
103
+ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi (params, options, callback) {
104
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
105
+
106
+ // check required parameters
107
+ if (params['name'] == null) {
108
+ const err = new this[kConfigurationError]('Missing required parameter: name')
109
+ return handleError(err, callback)
110
+ }
111
+
112
+ var { method, body, name, ...querystring } = params
113
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
114
+
115
+ var path = ''
116
+ if (method == null) method = 'HEAD'
117
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
118
+
119
+ // build request object
120
+ const request = {
121
+ method,
122
+ path,
123
+ body: null,
124
+ querystring
125
+ }
126
+
127
+ return this.transport.request(request, options, callback)
128
+ }
129
+
130
+ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi (params, options, callback) {
131
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
132
+
133
+ var { method, body, name, ...querystring } = params
134
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
135
+
136
+ var path = ''
137
+ if ((name) != null) {
138
+ if (method == null) method = 'GET'
139
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
140
+ } else {
141
+ if (method == null) method = 'GET'
142
+ path = '/' + '_component_template'
143
+ }
144
+
145
+ // build request object
146
+ const request = {
147
+ method,
148
+ path,
149
+ body: null,
150
+ querystring
151
+ }
152
+
153
+ return this.transport.request(request, options, callback)
154
+ }
155
+
156
+ ClusterApi.prototype.getSettings = function clusterGetSettingsApi (params, options, callback) {
157
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
158
+
159
+ var { method, body, ...querystring } = params
160
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
161
+
162
+ var path = ''
163
+ if (method == null) method = 'GET'
164
+ path = '/' + '_cluster' + '/' + 'settings'
165
+
166
+ // build request object
167
+ const request = {
168
+ method,
169
+ path,
170
+ body: null,
171
+ querystring
172
+ }
173
+
174
+ return this.transport.request(request, options, callback)
175
+ }
176
+
177
+ ClusterApi.prototype.health = function clusterHealthApi (params, options, callback) {
178
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
179
+
180
+ var { method, body, index, ...querystring } = params
181
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
182
+
183
+ var path = ''
184
+ if ((index) != null) {
185
+ if (method == null) method = 'GET'
186
+ path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(index)
187
+ } else {
188
+ if (method == null) method = 'GET'
189
+ path = '/' + '_cluster' + '/' + 'health'
190
+ }
191
+
192
+ // build request object
193
+ const request = {
194
+ method,
195
+ path,
196
+ body: null,
197
+ querystring
198
+ }
199
+
200
+ return this.transport.request(request, options, callback)
201
+ }
202
+
203
+ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi (params, options, callback) {
204
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
205
+
206
+ var { method, body, ...querystring } = params
207
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
208
+
209
+ var path = ''
210
+ if (method == null) method = 'GET'
211
+ path = '/' + '_cluster' + '/' + 'pending_tasks'
212
+
213
+ // build request object
214
+ const request = {
215
+ method,
216
+ path,
217
+ body: null,
218
+ querystring
219
+ }
220
+
221
+ return this.transport.request(request, options, callback)
222
+ }
223
+
224
+ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi (params, options, callback) {
225
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
226
+
227
+ var { method, body, ...querystring } = params
228
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
229
+
230
+ var path = ''
231
+ if (method == null) method = 'POST'
232
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
233
+
234
+ // build request object
235
+ const request = {
236
+ method,
237
+ path,
238
+ body: body || '',
239
+ querystring
240
+ }
241
+
242
+ return this.transport.request(request, options, callback)
243
+ }
244
+
245
+ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi (params, options, callback) {
246
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
247
+
248
+ // check required parameters
249
+ if (params['name'] == null) {
250
+ const err = new this[kConfigurationError]('Missing required parameter: name')
251
+ return handleError(err, callback)
252
+ }
253
+ if (params['body'] == null) {
254
+ const err = new this[kConfigurationError]('Missing required parameter: body')
255
+ return handleError(err, callback)
256
+ }
257
+
258
+ var { method, body, name, ...querystring } = params
259
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
260
+
261
+ var path = ''
262
+ if (method == null) method = 'PUT'
263
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name)
264
+
265
+ // build request object
266
+ const request = {
267
+ method,
268
+ path,
269
+ body: body || '',
270
+ querystring
271
+ }
272
+
273
+ return this.transport.request(request, options, callback)
274
+ }
275
+
276
+ ClusterApi.prototype.putSettings = function clusterPutSettingsApi (params, options, callback) {
277
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
278
+
279
+ // check required parameters
280
+ if (params['body'] == null) {
281
+ const err = new this[kConfigurationError]('Missing required parameter: body')
282
+ return handleError(err, callback)
283
+ }
284
+
285
+ var { method, body, ...querystring } = params
286
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
287
+
288
+ var path = ''
289
+ if (method == null) method = 'PUT'
290
+ path = '/' + '_cluster' + '/' + 'settings'
291
+
292
+ // build request object
293
+ const request = {
294
+ method,
295
+ path,
296
+ body: body || '',
297
+ querystring
298
+ }
299
+
300
+ return this.transport.request(request, options, callback)
301
+ }
302
+
303
+ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi (params, options, callback) {
304
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
305
+
306
+ var { method, body, ...querystring } = params
307
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
308
+
309
+ var path = ''
310
+ if (method == null) method = 'GET'
311
+ path = '/' + '_remote' + '/' + 'info'
312
+
313
+ // build request object
314
+ const request = {
315
+ method,
316
+ path,
317
+ body: null,
318
+ querystring
319
+ }
320
+
321
+ return this.transport.request(request, options, callback)
322
+ }
323
+
324
+ ClusterApi.prototype.reroute = function clusterRerouteApi (params, options, callback) {
325
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
326
+
327
+ var { method, body, ...querystring } = params
328
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
329
+
330
+ var path = ''
331
+ if (method == null) method = 'POST'
332
+ path = '/' + '_cluster' + '/' + 'reroute'
333
+
334
+ // build request object
335
+ const request = {
336
+ method,
337
+ path,
338
+ body: body || '',
339
+ querystring
340
+ }
341
+
342
+ return this.transport.request(request, options, callback)
343
+ }
344
+
345
+ ClusterApi.prototype.state = function clusterStateApi (params, options, callback) {
346
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
347
+
348
+ // check required url components
349
+ if (params['index'] != null && (params['metric'] == null)) {
350
+ const err = new this[kConfigurationError]('Missing required parameter of the url: metric')
351
+ return handleError(err, callback)
352
+ }
353
+
354
+ var { method, body, metric, index, ...querystring } = params
355
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
356
+
357
+ var path = ''
358
+ if ((metric) != null && (index) != null) {
359
+ if (method == null) method = 'GET'
360
+ path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
361
+ } else if ((metric) != null) {
362
+ if (method == null) method = 'GET'
363
+ path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
364
+ } else {
365
+ if (method == null) method = 'GET'
366
+ path = '/' + '_cluster' + '/' + 'state'
367
+ }
368
+
369
+ // build request object
370
+ const request = {
371
+ method,
372
+ path,
373
+ body: null,
374
+ querystring
375
+ }
376
+
377
+ return this.transport.request(request, options, callback)
378
+ }
379
+
380
+ ClusterApi.prototype.stats = function clusterStatsApi (params, options, callback) {
381
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
382
+
383
+ var { method, body, nodeId, node_id, ...querystring } = params
384
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
385
+
386
+ var path = ''
387
+ if ((node_id || nodeId) != null) {
388
+ if (method == null) method = 'GET'
389
+ path = '/' + '_cluster' + '/' + 'stats' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId)
390
+ } else {
391
+ if (method == null) method = 'GET'
392
+ path = '/' + '_cluster' + '/' + 'stats'
393
+ }
394
+
395
+ // build request object
396
+ const request = {
397
+ method,
398
+ path,
399
+ body: null,
400
+ querystring
401
+ }
402
+
403
+ return this.transport.request(request, options, callback)
404
+ }
405
+
406
+ Object.defineProperties(ClusterApi.prototype, {
407
+ allocation_explain: { get () { return this.allocationExplain } },
408
+ delete_component_template: { get () { return this.deleteComponentTemplate } },
409
+ delete_voting_config_exclusions: { get () { return this.deleteVotingConfigExclusions } },
410
+ exists_component_template: { get () { return this.existsComponentTemplate } },
411
+ get_component_template: { get () { return this.getComponentTemplate } },
412
+ get_settings: { get () { return this.getSettings } },
413
+ pending_tasks: { get () { return this.pendingTasks } },
414
+ post_voting_config_exclusions: { get () { return this.postVotingConfigExclusions } },
415
+ put_component_template: { get () { return this.putComponentTemplate } },
416
+ put_settings: { get () { return this.putSettings } },
417
+ remote_info: { get () { return this.remoteInfo } }
418
+ })
419
+
420
+ module.exports = ClusterApi
package/api/api/count.js CHANGED
@@ -1,113 +1,64 @@
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
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
4
19
 
5
20
  'use strict'
6
21
 
7
22
  /* eslint camelcase: 0 */
8
23
  /* eslint no-unused-vars: 0 */
9
24
 
10
- function buildCount (opts) {
11
- // eslint-disable-next-line no-unused-vars
12
- const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'terminate_after', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', minScore: 'min_score', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', terminateAfter: 'terminate_after', errorTrace: 'error_trace', filterPath: 'filter_path' }
13
28
 
14
- const acceptedQuerystring = [
15
- 'ignore_unavailable',
16
- 'ignore_throttled',
17
- 'allow_no_indices',
18
- 'expand_wildcards',
19
- 'min_score',
20
- 'preference',
21
- 'routing',
22
- 'q',
23
- 'analyzer',
24
- 'analyze_wildcard',
25
- 'default_operator',
26
- 'df',
27
- 'lenient',
28
- 'terminate_after',
29
- 'pretty',
30
- 'human',
31
- 'error_trace',
32
- 'source',
33
- 'filter_path'
34
- ]
29
+ function countApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
35
31
 
36
- const snakeCase = {
37
- ignoreUnavailable: 'ignore_unavailable',
38
- ignoreThrottled: 'ignore_throttled',
39
- allowNoIndices: 'allow_no_indices',
40
- expandWildcards: 'expand_wildcards',
41
- minScore: 'min_score',
42
- analyzeWildcard: 'analyze_wildcard',
43
- defaultOperator: 'default_operator',
44
- terminateAfter: 'terminate_after',
45
- errorTrace: 'error_trace',
46
- filterPath: 'filter_path'
32
+ // check required url components
33
+ if (params['type'] != null && (params['index'] == null)) {
34
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
35
+ return handleError(err, callback)
47
36
  }
48
37
 
49
- /**
50
- * Perform a count request
51
- * Returns number of documents matching a query.
52
- * https://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html
53
- */
54
- return function count (params, options, callback) {
55
- options = options || {}
56
- if (typeof options === 'function') {
57
- callback = options
58
- options = {}
59
- }
60
- if (typeof params === 'function' || params == null) {
61
- callback = params
62
- params = {}
63
- options = {}
64
- }
38
+ var { method, body, index, type, ...querystring } = params
39
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
65
40
 
66
- // check required url components
67
- if (params['type'] != null && (params['index'] == null)) {
68
- const err = new ConfigurationError('Missing required parameter of the url: index')
69
- return handleError(err, callback)
70
- }
71
-
72
- // validate headers object
73
- if (options.headers != null && typeof options.headers !== 'object') {
74
- const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
75
- return handleError(err, callback)
76
- }
77
-
78
- var warnings = []
79
- var { method, body, index, type, ...querystring } = params
80
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
81
-
82
- var ignore = options.ignore
83
- if (typeof ignore === 'number') {
84
- options.ignore = [ignore]
85
- }
86
-
87
- var path = ''
88
-
89
- if ((index) != null && (type) != null) {
90
- if (method == null) method = body == null ? 'GET' : 'POST'
91
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
92
- } else if ((index) != null) {
93
- if (method == null) method = body == null ? 'GET' : 'POST'
94
- path = '/' + encodeURIComponent(index) + '/' + '_count'
95
- } else {
96
- if (method == null) method = body == null ? 'GET' : 'POST'
97
- path = '/' + '_count'
98
- }
99
-
100
- // build request object
101
- const request = {
102
- method,
103
- path,
104
- body: body || '',
105
- querystring
106
- }
41
+ var path = ''
42
+ if ((index) != null && (type) != null) {
43
+ if (method == null) method = body == null ? 'GET' : 'POST'
44
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_count'
45
+ } else if ((index) != null) {
46
+ if (method == null) method = body == null ? 'GET' : 'POST'
47
+ path = '/' + encodeURIComponent(index) + '/' + '_count'
48
+ } else {
49
+ if (method == null) method = body == null ? 'GET' : 'POST'
50
+ path = '/' + '_count'
51
+ }
107
52
 
108
- options.warnings = warnings.length === 0 ? null : warnings
109
- return makeRequest(request, options, callback)
53
+ // build request object
54
+ const request = {
55
+ method,
56
+ path,
57
+ body: body || '',
58
+ querystring
110
59
  }
60
+
61
+ return this.transport.request(request, options, callback)
111
62
  }
112
63
 
113
- module.exports = buildCount
64
+ module.exports = countApi