@elastic/elasticsearch 7.8.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 (370) hide show
  1. package/README.md +10 -2
  2. package/api/api/async_search.js +114 -0
  3. package/api/api/autoscaling.js +147 -0
  4. package/api/api/bulk.js +55 -98
  5. package/api/api/cat.js +648 -0
  6. package/api/api/ccr.js +403 -0
  7. package/api/api/clear_scroll.js +42 -69
  8. package/api/api/cluster.js +420 -0
  9. package/api/api/count.js +49 -98
  10. package/api/api/create.js +54 -92
  11. package/api/api/dangling_indices.js +115 -0
  12. package/api/api/delete.js +50 -89
  13. package/api/api/delete_by_query.js +55 -135
  14. package/api/api/delete_by_query_rethrottle.js +45 -74
  15. package/api/api/delete_script.js +41 -71
  16. package/api/api/enrich.js +173 -0
  17. package/api/api/eql.js +119 -0
  18. package/api/api/exists.js +50 -95
  19. package/api/api/exists_source.js +58 -101
  20. package/api/api/explain.js +50 -98
  21. package/api/api/field_caps.js +42 -78
  22. package/api/api/get.js +50 -95
  23. package/api/api/get_script.js +41 -70
  24. package/api/api/get_script_context.js +37 -64
  25. package/api/api/get_script_languages.js +37 -64
  26. package/api/api/get_source.js +50 -93
  27. package/api/api/graph.js +72 -0
  28. package/api/api/ilm.js +295 -0
  29. package/api/api/index.js +56 -98
  30. package/api/api/indices.js +1656 -0
  31. package/api/api/info.js +37 -64
  32. package/api/api/ingest.js +178 -0
  33. package/api/api/license.js +188 -0
  34. package/api/api/mget.js +55 -97
  35. package/api/api/migration.js +60 -0
  36. package/api/api/ml.js +1842 -0
  37. package/api/api/monitoring.js +66 -0
  38. package/api/api/msearch.js +55 -96
  39. package/api/api/msearch_template.js +55 -92
  40. package/api/api/mtermvectors.js +49 -91
  41. package/api/api/nodes.js +202 -0
  42. package/api/api/ping.js +37 -64
  43. package/api/api/put_script.js +55 -86
  44. package/api/api/rank_eval.js +46 -81
  45. package/api/api/reindex.js +41 -82
  46. package/api/api/reindex_rethrottle.js +45 -74
  47. package/api/api/render_search_template.js +42 -69
  48. package/api/api/rollup.js +278 -0
  49. package/api/api/scripts_painless_execute.js +37 -64
  50. package/api/api/scroll.js +42 -74
  51. package/api/api/search.js +49 -149
  52. package/api/api/search_shards.js +42 -78
  53. package/api/api/search_template.js +55 -103
  54. package/api/api/searchable_snapshots.js +159 -0
  55. package/api/api/security.js +805 -0
  56. package/api/api/slm.js +256 -0
  57. package/api/api/snapshot.js +363 -0
  58. package/api/api/sql.js +119 -0
  59. package/api/api/ssl.js +55 -0
  60. package/api/api/tasks.js +108 -0
  61. package/api/api/termvectors.js +52 -93
  62. package/api/api/transform.js +268 -0
  63. package/api/api/update.js +54 -102
  64. package/api/api/update_by_query.js +51 -135
  65. package/api/api/update_by_query_rethrottle.js +45 -74
  66. package/api/api/watcher.js +311 -0
  67. package/api/api/xpack.js +76 -0
  68. package/api/index.js +408 -655
  69. package/api/kibana.d.ts +459 -0
  70. package/api/requestParams.d.ts +875 -802
  71. package/api/utils.js +58 -0
  72. package/index.d.ts +2349 -2258
  73. package/index.js +97 -76
  74. package/index.mjs +10 -0
  75. package/lib/Connection.d.ts +1 -1
  76. package/lib/Connection.js +9 -4
  77. package/lib/Helpers.d.ts +5 -5
  78. package/lib/Helpers.js +4 -3
  79. package/lib/Transport.d.ts +8 -6
  80. package/lib/Transport.js +41 -26
  81. package/lib/errors.d.ts +7 -7
  82. package/package.json +12 -4
  83. package/api/api/async_search.delete.js +0 -78
  84. package/api/api/async_search.get.js +0 -82
  85. package/api/api/async_search.submit.js +0 -147
  86. package/api/api/autoscaling.delete_autoscaling_policy.js +0 -78
  87. package/api/api/autoscaling.get_autoscaling_decision.js +0 -72
  88. package/api/api/autoscaling.get_autoscaling_policy.js +0 -78
  89. package/api/api/autoscaling.put_autoscaling_policy.js +0 -82
  90. package/api/api/cat.aliases.js +0 -90
  91. package/api/api/cat.allocation.js +0 -91
  92. package/api/api/cat.count.js +0 -87
  93. package/api/api/cat.fielddata.js +0 -89
  94. package/api/api/cat.health.js +0 -84
  95. package/api/api/cat.help.js +0 -79
  96. package/api/api/cat.indices.js +0 -98
  97. package/api/api/cat.master.js +0 -85
  98. package/api/api/cat.ml_data_frame_analytics.js +0 -85
  99. package/api/api/cat.ml_datafeeds.js +0 -84
  100. package/api/api/cat.ml_jobs.js +0 -85
  101. package/api/api/cat.ml_trained_models.js +0 -87
  102. package/api/api/cat.nodeattrs.js +0 -85
  103. package/api/api/cat.nodes.js +0 -89
  104. package/api/api/cat.pending_tasks.js +0 -86
  105. package/api/api/cat.plugins.js +0 -85
  106. package/api/api/cat.recovery.js +0 -93
  107. package/api/api/cat.repositories.js +0 -85
  108. package/api/api/cat.segments.js +0 -88
  109. package/api/api/cat.shards.js +0 -92
  110. package/api/api/cat.snapshots.js +0 -92
  111. package/api/api/cat.tasks.js +0 -89
  112. package/api/api/cat.templates.js +0 -90
  113. package/api/api/cat.thread_pool.js +0 -92
  114. package/api/api/cat.transforms.js +0 -86
  115. package/api/api/ccr.delete_auto_follow_pattern.js +0 -78
  116. package/api/api/ccr.follow.js +0 -82
  117. package/api/api/ccr.follow_info.js +0 -78
  118. package/api/api/ccr.follow_stats.js +0 -78
  119. package/api/api/ccr.forget_follower.js +0 -82
  120. package/api/api/ccr.get_auto_follow_pattern.js +0 -77
  121. package/api/api/ccr.pause_auto_follow_pattern.js +0 -78
  122. package/api/api/ccr.pause_follow.js +0 -78
  123. package/api/api/ccr.put_auto_follow_pattern.js +0 -82
  124. package/api/api/ccr.resume_auto_follow_pattern.js +0 -78
  125. package/api/api/ccr.resume_follow.js +0 -78
  126. package/api/api/ccr.stats.js +0 -72
  127. package/api/api/ccr.unfollow.js +0 -78
  128. package/api/api/cluster.allocation_explain.js +0 -81
  129. package/api/api/cluster.delete_component_template.js +0 -86
  130. package/api/api/cluster.delete_voting_config_exclusions.js +0 -79
  131. package/api/api/cluster.exists_component_template.js +0 -86
  132. package/api/api/cluster.get_component_template.js +0 -85
  133. package/api/api/cluster.get_settings.js +0 -84
  134. package/api/api/cluster.health.js +0 -101
  135. package/api/api/cluster.pending_tasks.js +0 -81
  136. package/api/api/cluster.post_voting_config_exclusions.js +0 -82
  137. package/api/api/cluster.put_component_template.js +0 -91
  138. package/api/api/cluster.put_settings.js +0 -88
  139. package/api/api/cluster.remote_info.js +0 -77
  140. package/api/api/cluster.reroute.js +0 -86
  141. package/api/api/cluster.state.js +0 -106
  142. package/api/api/cluster.stats.js +0 -85
  143. package/api/api/enrich.delete_policy.js +0 -78
  144. package/api/api/enrich.execute_policy.js +0 -78
  145. package/api/api/enrich.get_policy.js +0 -77
  146. package/api/api/enrich.put_policy.js +0 -82
  147. package/api/api/enrich.stats.js +0 -72
  148. package/api/api/eql.search.js +0 -82
  149. package/api/api/graph.explore.js +0 -90
  150. package/api/api/ilm.delete_lifecycle.js +0 -78
  151. package/api/api/ilm.explain_lifecycle.js +0 -80
  152. package/api/api/ilm.get_lifecycle.js +0 -77
  153. package/api/api/ilm.get_status.js +0 -72
  154. package/api/api/ilm.move_to_step.js +0 -78
  155. package/api/api/ilm.put_lifecycle.js +0 -78
  156. package/api/api/ilm.remove_policy.js +0 -78
  157. package/api/api/ilm.retry.js +0 -78
  158. package/api/api/ilm.start.js +0 -72
  159. package/api/api/ilm.stop.js +0 -72
  160. package/api/api/indices.analyze.js +0 -83
  161. package/api/api/indices.clear_cache.js +0 -93
  162. package/api/api/indices.clone.js +0 -98
  163. package/api/api/indices.close.js +0 -94
  164. package/api/api/indices.create.js +0 -90
  165. package/api/api/indices.create_data_stream.js +0 -87
  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 -83
  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_streams.js +0 -82
  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 -117
  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.rollover.js +0 -104
  199. package/api/api/indices.segments.js +0 -89
  200. package/api/api/indices.shard_stores.js +0 -89
  201. package/api/api/indices.shrink.js +0 -100
  202. package/api/api/indices.simulate_index_template.js +0 -87
  203. package/api/api/indices.split.js +0 -100
  204. package/api/api/indices.stats.js +0 -104
  205. package/api/api/indices.unfreeze.js +0 -87
  206. package/api/api/indices.update_aliases.js +0 -86
  207. package/api/api/indices.upgrade.js +0 -92
  208. package/api/api/indices.validate_query.js +0 -109
  209. package/api/api/ingest.delete_pipeline.js +0 -86
  210. package/api/api/ingest.get_pipeline.js +0 -84
  211. package/api/api/ingest.processor_grok.js +0 -77
  212. package/api/api/ingest.put_pipeline.js +0 -90
  213. package/api/api/ingest.simulate.js +0 -89
  214. package/api/api/license.delete.js +0 -72
  215. package/api/api/license.get.js +0 -73
  216. package/api/api/license.get_basic_status.js +0 -72
  217. package/api/api/license.get_trial_status.js +0 -72
  218. package/api/api/license.post.js +0 -72
  219. package/api/api/license.post_start_basic.js +0 -72
  220. package/api/api/license.post_start_trial.js +0 -73
  221. package/api/api/migration.deprecations.js +0 -77
  222. package/api/api/ml.close_job.js +0 -81
  223. package/api/api/ml.delete_calendar.js +0 -78
  224. package/api/api/ml.delete_calendar_event.js +0 -88
  225. package/api/api/ml.delete_calendar_job.js +0 -88
  226. package/api/api/ml.delete_data_frame_analytics.js +0 -79
  227. package/api/api/ml.delete_datafeed.js +0 -78
  228. package/api/api/ml.delete_expired_data.js +0 -72
  229. package/api/api/ml.delete_filter.js +0 -78
  230. package/api/api/ml.delete_forecast.js +0 -91
  231. package/api/api/ml.delete_job.js +0 -79
  232. package/api/api/ml.delete_model_snapshot.js +0 -88
  233. package/api/api/ml.delete_trained_model.js +0 -78
  234. package/api/api/ml.estimate_model_memory.js +0 -78
  235. package/api/api/ml.evaluate_data_frame.js +0 -78
  236. package/api/api/ml.explain_data_frame_analytics.js +0 -77
  237. package/api/api/ml.find_file_structure.js +0 -99
  238. package/api/api/ml.flush_job.js +0 -84
  239. package/api/api/ml.forecast.js +0 -79
  240. package/api/api/ml.get_buckets.js +0 -99
  241. package/api/api/ml.get_calendar_events.js +0 -83
  242. package/api/api/ml.get_calendars.js +0 -78
  243. package/api/api/ml.get_categories.js +0 -90
  244. package/api/api/ml.get_data_frame_analytics.js +0 -80
  245. package/api/api/ml.get_data_frame_analytics_stats.js +0 -80
  246. package/api/api/ml.get_datafeed_stats.js +0 -77
  247. package/api/api/ml.get_datafeeds.js +0 -77
  248. package/api/api/ml.get_filters.js +0 -78
  249. package/api/api/ml.get_influencers.js +0 -87
  250. package/api/api/ml.get_job_stats.js +0 -77
  251. package/api/api/ml.get_jobs.js +0 -77
  252. package/api/api/ml.get_model_snapshots.js +0 -94
  253. package/api/api/ml.get_overall_buckets.js +0 -88
  254. package/api/api/ml.get_records.js +0 -87
  255. package/api/api/ml.get_trained_models.js +0 -85
  256. package/api/api/ml.get_trained_models_stats.js +0 -80
  257. package/api/api/ml.info.js +0 -72
  258. package/api/api/ml.open_job.js +0 -78
  259. package/api/api/ml.post_calendar_events.js +0 -82
  260. package/api/api/ml.post_data.js +0 -84
  261. package/api/api/ml.preview_datafeed.js +0 -78
  262. package/api/api/ml.put_calendar.js +0 -78
  263. package/api/api/ml.put_calendar_job.js +0 -88
  264. package/api/api/ml.put_data_frame_analytics.js +0 -82
  265. package/api/api/ml.put_datafeed.js +0 -88
  266. package/api/api/ml.put_filter.js +0 -82
  267. package/api/api/ml.put_job.js +0 -82
  268. package/api/api/ml.put_trained_model.js +0 -82
  269. package/api/api/ml.revert_model_snapshot.js +0 -88
  270. package/api/api/ml.set_upgrade_mode.js +0 -73
  271. package/api/api/ml.start_data_frame_analytics.js +0 -78
  272. package/api/api/ml.start_datafeed.js +0 -80
  273. package/api/api/ml.stop_data_frame_analytics.js +0 -81
  274. package/api/api/ml.stop_datafeed.js +0 -81
  275. package/api/api/ml.update_datafeed.js +0 -88
  276. package/api/api/ml.update_filter.js +0 -82
  277. package/api/api/ml.update_job.js +0 -82
  278. package/api/api/ml.update_model_snapshot.js +0 -92
  279. package/api/api/ml.validate.js +0 -78
  280. package/api/api/ml.validate_detector.js +0 -78
  281. package/api/api/monitoring.bulk.js +0 -87
  282. package/api/api/nodes.hot_threads.js +0 -98
  283. package/api/api/nodes.info.js +0 -91
  284. package/api/api/nodes.reload_secure_settings.js +0 -83
  285. package/api/api/nodes.stats.js +0 -105
  286. package/api/api/nodes.usage.js +0 -89
  287. package/api/api/rollup.delete_job.js +0 -78
  288. package/api/api/rollup.get_jobs.js +0 -77
  289. package/api/api/rollup.get_rollup_caps.js +0 -77
  290. package/api/api/rollup.get_rollup_index_caps.js +0 -78
  291. package/api/api/rollup.put_job.js +0 -82
  292. package/api/api/rollup.rollup_search.js +0 -95
  293. package/api/api/rollup.start_job.js +0 -78
  294. package/api/api/rollup.stop_job.js +0 -80
  295. package/api/api/searchable_snapshots.clear_cache.js +0 -83
  296. package/api/api/searchable_snapshots.mount.js +0 -94
  297. package/api/api/searchable_snapshots.repository_stats.js +0 -78
  298. package/api/api/searchable_snapshots.stats.js +0 -77
  299. package/api/api/security.authenticate.js +0 -72
  300. package/api/api/security.change_password.js +0 -83
  301. package/api/api/security.clear_cached_realms.js +0 -78
  302. package/api/api/security.clear_cached_roles.js +0 -78
  303. package/api/api/security.create_api_key.js +0 -78
  304. package/api/api/security.delete_privileges.js +0 -88
  305. package/api/api/security.delete_role.js +0 -78
  306. package/api/api/security.delete_role_mapping.js +0 -78
  307. package/api/api/security.delete_user.js +0 -78
  308. package/api/api/security.disable_user.js +0 -78
  309. package/api/api/security.enable_user.js +0 -78
  310. package/api/api/security.get_api_key.js +0 -77
  311. package/api/api/security.get_builtin_privileges.js +0 -72
  312. package/api/api/security.get_privileges.js +0 -86
  313. package/api/api/security.get_role.js +0 -77
  314. package/api/api/security.get_role_mapping.js +0 -77
  315. package/api/api/security.get_token.js +0 -78
  316. package/api/api/security.get_user.js +0 -77
  317. package/api/api/security.get_user_privileges.js +0 -72
  318. package/api/api/security.has_privileges.js +0 -83
  319. package/api/api/security.invalidate_api_key.js +0 -78
  320. package/api/api/security.invalidate_token.js +0 -78
  321. package/api/api/security.put_privileges.js +0 -78
  322. package/api/api/security.put_role.js +0 -82
  323. package/api/api/security.put_role_mapping.js +0 -82
  324. package/api/api/security.put_user.js +0 -82
  325. package/api/api/slm.delete_lifecycle.js +0 -78
  326. package/api/api/slm.execute_lifecycle.js +0 -78
  327. package/api/api/slm.execute_retention.js +0 -72
  328. package/api/api/slm.get_lifecycle.js +0 -77
  329. package/api/api/slm.get_stats.js +0 -72
  330. package/api/api/slm.get_status.js +0 -72
  331. package/api/api/slm.put_lifecycle.js +0 -78
  332. package/api/api/slm.start.js +0 -72
  333. package/api/api/slm.stop.js +0 -72
  334. package/api/api/snapshot.cleanup_repository.js +0 -86
  335. package/api/api/snapshot.create.js +0 -97
  336. package/api/api/snapshot.create_repository.js +0 -91
  337. package/api/api/snapshot.delete.js +0 -95
  338. package/api/api/snapshot.delete_repository.js +0 -86
  339. package/api/api/snapshot.get.js +0 -98
  340. package/api/api/snapshot.get_repository.js +0 -85
  341. package/api/api/snapshot.restore.js +0 -97
  342. package/api/api/snapshot.status.js +0 -95
  343. package/api/api/snapshot.verify_repository.js +0 -86
  344. package/api/api/sql.clear_cursor.js +0 -78
  345. package/api/api/sql.query.js +0 -78
  346. package/api/api/sql.translate.js +0 -78
  347. package/api/api/ssl.certificates.js +0 -72
  348. package/api/api/tasks.cancel.js +0 -88
  349. package/api/api/tasks.get.js +0 -86
  350. package/api/api/tasks.list.js +0 -87
  351. package/api/api/transform.delete_transform.js +0 -78
  352. package/api/api/transform.get_transform.js +0 -79
  353. package/api/api/transform.get_transform_stats.js +0 -80
  354. package/api/api/transform.preview_transform.js +0 -78
  355. package/api/api/transform.put_transform.js +0 -82
  356. package/api/api/transform.start_transform.js +0 -78
  357. package/api/api/transform.stop_transform.js +0 -84
  358. package/api/api/transform.update_transform.js +0 -82
  359. package/api/api/watcher.ack_watch.js +0 -89
  360. package/api/api/watcher.activate_watch.js +0 -78
  361. package/api/api/watcher.deactivate_watch.js +0 -78
  362. package/api/api/watcher.delete_watch.js +0 -78
  363. package/api/api/watcher.execute_watch.js +0 -77
  364. package/api/api/watcher.get_watch.js +0 -78
  365. package/api/api/watcher.put_watch.js +0 -82
  366. package/api/api/watcher.start.js +0 -72
  367. package/api/api/watcher.stats.js +0 -78
  368. package/api/api/watcher.stop.js +0 -72
  369. package/api/api/xpack.info.js +0 -72
  370. package/api/api/xpack.usage.js +0 -72
package/api/api/create.js CHANGED
@@ -1,107 +1,69 @@
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 buildCreate (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 = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'version', 'version_type', 'pipeline', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
13
28
 
14
- const acceptedQuerystring = [
15
- 'wait_for_active_shards',
16
- 'refresh',
17
- 'routing',
18
- 'timeout',
19
- 'version',
20
- 'version_type',
21
- 'pipeline',
22
- 'pretty',
23
- 'human',
24
- 'error_trace',
25
- 'source',
26
- 'filter_path'
27
- ]
29
+ function createApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
28
31
 
29
- const snakeCase = {
30
- waitForActiveShards: 'wait_for_active_shards',
31
- versionType: 'version_type',
32
- errorTrace: 'error_trace',
33
- filterPath: 'filter_path'
32
+ // check required parameters
33
+ if (params['id'] == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: id')
35
+ return handleError(err, callback)
36
+ }
37
+ if (params['index'] == null) {
38
+ const err = new this[kConfigurationError]('Missing required parameter: index')
39
+ return handleError(err, callback)
40
+ }
41
+ if (params['body'] == null) {
42
+ const err = new this[kConfigurationError]('Missing required parameter: body')
43
+ return handleError(err, callback)
34
44
  }
35
45
 
36
- /**
37
- * Perform a create request
38
- * Creates a new document in the index.
39
-
40
- Returns a 409 response when a document with a same ID already exists in the index.
41
- * https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html
42
- */
43
- return function create (params, options, callback) {
44
- options = options || {}
45
- if (typeof options === 'function') {
46
- callback = options
47
- options = {}
48
- }
49
- if (typeof params === 'function' || params == null) {
50
- callback = params
51
- params = {}
52
- options = {}
53
- }
54
-
55
- // check required parameters
56
- if (params['id'] == null) {
57
- const err = new ConfigurationError('Missing required parameter: id')
58
- return handleError(err, callback)
59
- }
60
- if (params['index'] == null) {
61
- const err = new ConfigurationError('Missing required parameter: index')
62
- return handleError(err, callback)
63
- }
64
- if (params['body'] == null) {
65
- const err = new ConfigurationError('Missing required parameter: body')
66
- return handleError(err, callback)
67
- }
68
-
69
- // validate headers object
70
- if (options.headers != null && typeof options.headers !== 'object') {
71
- const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
72
- return handleError(err, callback)
73
- }
74
-
75
- var warnings = []
76
- var { method, body, id, index, type, ...querystring } = params
77
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
78
-
79
- var ignore = options.ignore
80
- if (typeof ignore === 'number') {
81
- options.ignore = [ignore]
82
- }
83
-
84
- var path = ''
85
-
86
- if ((index) != null && (type) != null && (id) != null) {
87
- if (method == null) method = 'PUT'
88
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
89
- } else {
90
- if (method == null) method = 'PUT'
91
- path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
92
- }
46
+ var { method, body, id, index, type, ...querystring } = params
47
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93
48
 
94
- // build request object
95
- const request = {
96
- method,
97
- path,
98
- body: body || '',
99
- querystring
100
- }
49
+ var path = ''
50
+ if ((index) != null && (type) != null && (id) != null) {
51
+ if (method == null) method = 'PUT'
52
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_create'
53
+ } else {
54
+ if (method == null) method = 'PUT'
55
+ path = '/' + encodeURIComponent(index) + '/' + '_create' + '/' + encodeURIComponent(id)
56
+ }
101
57
 
102
- options.warnings = warnings.length === 0 ? null : warnings
103
- return makeRequest(request, options, callback)
58
+ // build request object
59
+ const request = {
60
+ method,
61
+ path,
62
+ body: body || '',
63
+ querystring
104
64
  }
65
+
66
+ return this.transport.request(request, options, callback)
105
67
  }
106
68
 
107
- module.exports = buildCreate
69
+ module.exports = createApi
@@ -0,0 +1,115 @@
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 = ['accept_data_loss', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { acceptDataLoss: 'accept_data_loss', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function DanglingIndicesApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ // check required parameters
38
+ if (params['index_uuid'] == null && params['indexUuid'] == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
40
+ return handleError(err, callback)
41
+ }
42
+
43
+ var { method, body, indexUuid, index_uuid, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ var path = ''
47
+ if (method == null) method = 'DELETE'
48
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
49
+
50
+ // build request object
51
+ const request = {
52
+ method,
53
+ path,
54
+ body: body || '',
55
+ querystring
56
+ }
57
+
58
+ return this.transport.request(request, options, callback)
59
+ }
60
+
61
+ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi (params, options, callback) {
62
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+
64
+ // check required parameters
65
+ if (params['index_uuid'] == null && params['indexUuid'] == null) {
66
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
67
+ return handleError(err, callback)
68
+ }
69
+
70
+ var { method, body, indexUuid, index_uuid, ...querystring } = params
71
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72
+
73
+ var path = ''
74
+ if (method == null) method = 'POST'
75
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
76
+
77
+ // build request object
78
+ const request = {
79
+ method,
80
+ path,
81
+ body: body || '',
82
+ querystring
83
+ }
84
+
85
+ return this.transport.request(request, options, callback)
86
+ }
87
+
88
+ DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi (params, options, callback) {
89
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
90
+
91
+ var { method, body, ...querystring } = params
92
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93
+
94
+ var path = ''
95
+ if (method == null) method = 'GET'
96
+ path = '/' + '_dangling'
97
+
98
+ // build request object
99
+ const request = {
100
+ method,
101
+ path,
102
+ body: null,
103
+ querystring
104
+ }
105
+
106
+ return this.transport.request(request, options, callback)
107
+ }
108
+
109
+ Object.defineProperties(DanglingIndicesApi.prototype, {
110
+ delete_dangling_index: { get () { return this.deleteDanglingIndex } },
111
+ import_dangling_index: { get () { return this.importDanglingIndex } },
112
+ list_dangling_indices: { get () { return this.listDanglingIndices } }
113
+ })
114
+
115
+ module.exports = DanglingIndicesApi
package/api/api/delete.js CHANGED
@@ -1,104 +1,65 @@
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 buildDelete (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 = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
13
28
 
14
- const acceptedQuerystring = [
15
- 'wait_for_active_shards',
16
- 'refresh',
17
- 'routing',
18
- 'timeout',
19
- 'if_seq_no',
20
- 'if_primary_term',
21
- 'version',
22
- 'version_type',
23
- 'pretty',
24
- 'human',
25
- 'error_trace',
26
- 'source',
27
- 'filter_path'
28
- ]
29
+ function deleteApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
29
31
 
30
- const snakeCase = {
31
- waitForActiveShards: 'wait_for_active_shards',
32
- ifSeqNo: 'if_seq_no',
33
- ifPrimaryTerm: 'if_primary_term',
34
- versionType: 'version_type',
35
- errorTrace: 'error_trace',
36
- filterPath: 'filter_path'
32
+ // check required parameters
33
+ if (params['id'] == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: id')
35
+ return handleError(err, callback)
36
+ }
37
+ if (params['index'] == null) {
38
+ const err = new this[kConfigurationError]('Missing required parameter: index')
39
+ return handleError(err, callback)
37
40
  }
38
41
 
39
- /**
40
- * Perform a delete request
41
- * Removes a document from the index.
42
- * https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html
43
- */
44
- return function _delete (params, options, callback) {
45
- options = options || {}
46
- if (typeof options === 'function') {
47
- callback = options
48
- options = {}
49
- }
50
- if (typeof params === 'function' || params == null) {
51
- callback = params
52
- params = {}
53
- options = {}
54
- }
55
-
56
- // check required parameters
57
- if (params['id'] == null) {
58
- const err = new ConfigurationError('Missing required parameter: id')
59
- return handleError(err, callback)
60
- }
61
- if (params['index'] == null) {
62
- const err = new ConfigurationError('Missing required parameter: index')
63
- return handleError(err, callback)
64
- }
65
-
66
- // validate headers object
67
- if (options.headers != null && typeof options.headers !== 'object') {
68
- const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
69
- return handleError(err, callback)
70
- }
71
-
72
- var warnings = []
73
- var { method, body, id, index, type, ...querystring } = params
74
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
75
-
76
- var ignore = options.ignore
77
- if (typeof ignore === 'number') {
78
- options.ignore = [ignore]
79
- }
80
-
81
- var path = ''
82
-
83
- if ((index) != null && (type) != null && (id) != null) {
84
- if (method == null) method = 'DELETE'
85
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
86
- } else {
87
- if (method == null) method = 'DELETE'
88
- path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
89
- }
42
+ var { method, body, id, index, type, ...querystring } = params
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
90
44
 
91
- // build request object
92
- const request = {
93
- method,
94
- path,
95
- body: body || '',
96
- querystring
97
- }
45
+ var path = ''
46
+ if ((index) != null && (type) != null && (id) != null) {
47
+ if (method == null) method = 'DELETE'
48
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
49
+ } else {
50
+ if (method == null) method = 'DELETE'
51
+ path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
52
+ }
98
53
 
99
- options.warnings = warnings.length === 0 ? null : warnings
100
- return makeRequest(request, options, callback)
54
+ // build request object
55
+ const request = {
56
+ method,
57
+ path,
58
+ body: body || '',
59
+ querystring
101
60
  }
61
+
62
+ return this.transport.request(request, options, callback)
102
63
  }
103
64
 
104
- module.exports = buildDelete
65
+ module.exports = deleteApi
@@ -1,151 +1,71 @@
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 buildDeleteByQuery (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 = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'size', 'max_docs', 'sort', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', scrollSize: 'scroll_size', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
13
28
 
14
- const acceptedQuerystring = [
15
- 'analyzer',
16
- 'analyze_wildcard',
17
- 'default_operator',
18
- 'df',
19
- 'from',
20
- 'ignore_unavailable',
21
- 'allow_no_indices',
22
- 'conflicts',
23
- 'expand_wildcards',
24
- 'lenient',
25
- 'preference',
26
- 'q',
27
- 'routing',
28
- 'scroll',
29
- 'search_type',
30
- 'search_timeout',
31
- 'size',
32
- 'max_docs',
33
- 'sort',
34
- '_source',
35
- '_source_excludes',
36
- '_source_exclude',
37
- '_source_includes',
38
- '_source_include',
39
- 'terminate_after',
40
- 'stats',
41
- 'version',
42
- 'request_cache',
43
- 'refresh',
44
- 'timeout',
45
- 'wait_for_active_shards',
46
- 'scroll_size',
47
- 'wait_for_completion',
48
- 'requests_per_second',
49
- 'slices',
50
- 'pretty',
51
- 'human',
52
- 'error_trace',
53
- 'source',
54
- 'filter_path'
55
- ]
29
+ function deleteByQueryApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
56
31
 
57
- const snakeCase = {
58
- analyzeWildcard: 'analyze_wildcard',
59
- defaultOperator: 'default_operator',
60
- ignoreUnavailable: 'ignore_unavailable',
61
- allowNoIndices: 'allow_no_indices',
62
- expandWildcards: 'expand_wildcards',
63
- searchType: 'search_type',
64
- searchTimeout: 'search_timeout',
65
- maxDocs: 'max_docs',
66
- _sourceExcludes: '_source_excludes',
67
- _sourceExclude: '_source_exclude',
68
- _sourceIncludes: '_source_includes',
69
- _sourceInclude: '_source_include',
70
- terminateAfter: 'terminate_after',
71
- requestCache: 'request_cache',
72
- waitForActiveShards: 'wait_for_active_shards',
73
- scrollSize: 'scroll_size',
74
- waitForCompletion: 'wait_for_completion',
75
- requestsPerSecond: 'requests_per_second',
76
- errorTrace: 'error_trace',
77
- filterPath: 'filter_path'
32
+ // check required parameters
33
+ if (params['index'] == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: index')
35
+ return handleError(err, callback)
36
+ }
37
+ if (params['body'] == null) {
38
+ const err = new this[kConfigurationError]('Missing required parameter: body')
39
+ return handleError(err, callback)
78
40
  }
79
41
 
80
- /**
81
- * Perform a delete_by_query request
82
- * Deletes documents matching the provided query.
83
- * https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html
84
- */
85
- return function deleteByQuery (params, options, callback) {
86
- options = options || {}
87
- if (typeof options === 'function') {
88
- callback = options
89
- options = {}
90
- }
91
- if (typeof params === 'function' || params == null) {
92
- callback = params
93
- params = {}
94
- options = {}
95
- }
96
-
97
- // check required parameters
98
- if (params['index'] == null) {
99
- const err = new ConfigurationError('Missing required parameter: index')
100
- return handleError(err, callback)
101
- }
102
- if (params['body'] == null) {
103
- const err = new ConfigurationError('Missing required parameter: body')
104
- return handleError(err, callback)
105
- }
106
-
107
- // check required url components
108
- if (params['type'] != null && (params['index'] == null)) {
109
- const err = new ConfigurationError('Missing required parameter of the url: index')
110
- return handleError(err, callback)
111
- }
112
-
113
- // validate headers object
114
- if (options.headers != null && typeof options.headers !== 'object') {
115
- const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
116
- return handleError(err, callback)
117
- }
118
-
119
- var warnings = []
120
- var { method, body, index, type, ...querystring } = params
121
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
122
-
123
- var ignore = options.ignore
124
- if (typeof ignore === 'number') {
125
- options.ignore = [ignore]
126
- }
127
-
128
- var path = ''
42
+ // check required url components
43
+ if (params['type'] != null && (params['index'] == null)) {
44
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
45
+ return handleError(err, callback)
46
+ }
129
47
 
130
- if ((index) != null && (type) != null) {
131
- if (method == null) method = 'POST'
132
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
133
- } else {
134
- if (method == null) method = 'POST'
135
- path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
136
- }
48
+ var { method, body, index, type, ...querystring } = params
49
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
137
50
 
138
- // build request object
139
- const request = {
140
- method,
141
- path,
142
- body: body || '',
143
- querystring
144
- }
51
+ var path = ''
52
+ if ((index) != null && (type) != null) {
53
+ if (method == null) method = 'POST'
54
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
55
+ } else {
56
+ if (method == null) method = 'POST'
57
+ path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
58
+ }
145
59
 
146
- options.warnings = warnings.length === 0 ? null : warnings
147
- return makeRequest(request, options, callback)
60
+ // build request object
61
+ const request = {
62
+ method,
63
+ path,
64
+ body: body || '',
65
+ querystring
148
66
  }
67
+
68
+ return this.transport.request(request, options, callback)
149
69
  }
150
70
 
151
- module.exports = buildDeleteByQuery
71
+ module.exports = deleteByQueryApi