Skip to content

Commit c53c798

Browse files
authored
feat: add support for querystring in options object (#779)
In very few cases, some API uses the same key for both url and query params, such as the bulk method. The client is not designed to handle such cases since accepts both url and query keys in the same object, and the url parameter will always take precedence. This pr fixes this edge case by adding a `querystring` key in the options object. Fixes: #778 ```js client.bulk({ index: 'index', type: '_doc', body: [...] }, { querystring: { type: '_doc' } }, console.log) ```
1 parent 851e839 commit c53c798

File tree

261 files changed

+380
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+380
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion

api/api/bulk.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ function buildBulk (opts) {
149149
maxRetries: options.maxRetries || null,
150150
asStream: options.asStream || false,
151151
headers: options.headers || null,
152+
querystring: options.querystring || null,
152153
compression: options.compression || false,
153154
warnings
154155
}

api/api/cat.aliases.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function buildCatAliases (opts) {
131131
maxRetries: options.maxRetries || null,
132132
asStream: options.asStream || false,
133133
headers: options.headers || null,
134+
querystring: options.querystring || null,
134135
compression: options.compression || false,
135136
warnings
136137
}

api/api/cat.allocation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ function buildCatAllocation (opts) {
133133
maxRetries: options.maxRetries || null,
134134
asStream: options.asStream || false,
135135
headers: options.headers || null,
136+
querystring: options.querystring || null,
136137
compression: options.compression || false,
137138
warnings
138139
}

api/api/cat.count.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function buildCatCount (opts) {
131131
maxRetries: options.maxRetries || null,
132132
asStream: options.asStream || false,
133133
headers: options.headers || null,
134+
querystring: options.querystring || null,
134135
compression: options.compression || false,
135136
warnings
136137
}

api/api/cat.fielddata.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function buildCatFielddata (opts) {
135135
maxRetries: options.maxRetries || null,
136136
asStream: options.asStream || false,
137137
headers: options.headers || null,
138+
querystring: options.querystring || null,
138139
compression: options.compression || false,
139140
warnings
140141
}

api/api/cat.health.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function buildCatHealth (opts) {
128128
maxRetries: options.maxRetries || null,
129129
asStream: options.asStream || false,
130130
headers: options.headers || null,
131+
querystring: options.querystring || null,
131132
compression: options.compression || false,
132133
warnings
133134
}

api/api/cat.help.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function buildCatHelp (opts) {
115115
maxRetries: options.maxRetries || null,
116116
asStream: options.asStream || false,
117117
headers: options.headers || null,
118+
querystring: options.querystring || null,
118119
compression: options.compression || false,
119120
warnings
120121
}

api/api/cat.indices.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function buildCatIndices (opts) {
137137
maxRetries: options.maxRetries || null,
138138
asStream: options.asStream || false,
139139
headers: options.headers || null,
140+
querystring: options.querystring || null,
140141
compression: options.compression || false,
141142
warnings
142143
}

api/api/cat.master.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatMaster (opts) {
126126
maxRetries: options.maxRetries || null,
127127
asStream: options.asStream || false,
128128
headers: options.headers || null,
129+
querystring: options.querystring || null,
129130
compression: options.compression || false,
130131
warnings
131132
}

api/api/cat.nodeattrs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatNodeattrs (opts) {
126126
maxRetries: options.maxRetries || null,
127127
asStream: options.asStream || false,
128128
headers: options.headers || null,
129+
querystring: options.querystring || null,
129130
compression: options.compression || false,
130131
warnings
131132
}

api/api/cat.nodes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function buildCatNodes (opts) {
129129
maxRetries: options.maxRetries || null,
130130
asStream: options.asStream || false,
131131
headers: options.headers || null,
132+
querystring: options.querystring || null,
132133
compression: options.compression || false,
133134
warnings
134135
}

api/api/cat.pending_tasks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatPendingTasks (opts) {
126126
maxRetries: options.maxRetries || null,
127127
asStream: options.asStream || false,
128128
headers: options.headers || null,
129+
querystring: options.querystring || null,
129130
compression: options.compression || false,
130131
warnings
131132
}

api/api/cat.plugins.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatPlugins (opts) {
126126
maxRetries: options.maxRetries || null,
127127
asStream: options.asStream || false,
128128
headers: options.headers || null,
129+
querystring: options.querystring || null,
129130
compression: options.compression || false,
130131
warnings
131132
}

api/api/cat.recovery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function buildCatRecovery (opts) {
131131
maxRetries: options.maxRetries || null,
132132
asStream: options.asStream || false,
133133
headers: options.headers || null,
134+
querystring: options.querystring || null,
134135
compression: options.compression || false,
135136
warnings
136137
}

api/api/cat.repositories.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatRepositories (opts) {
126126
maxRetries: options.maxRetries || null,
127127
asStream: options.asStream || false,
128128
headers: options.headers || null,
129+
querystring: options.querystring || null,
129130
compression: options.compression || false,
130131
warnings
131132
}

api/api/cat.segments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function buildCatSegments (opts) {
128128
maxRetries: options.maxRetries || null,
129129
asStream: options.asStream || false,
130130
headers: options.headers || null,
131+
querystring: options.querystring || null,
131132
compression: options.compression || false,
132133
warnings
133134
}

api/api/cat.shards.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ function buildCatShards (opts) {
133133
maxRetries: options.maxRetries || null,
134134
asStream: options.asStream || false,
135135
headers: options.headers || null,
136+
querystring: options.querystring || null,
136137
compression: options.compression || false,
137138
warnings
138139
}

api/api/cat.snapshots.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ function buildCatSnapshots (opts) {
132132
maxRetries: options.maxRetries || null,
133133
asStream: options.asStream || false,
134134
headers: options.headers || null,
135+
querystring: options.querystring || null,
135136
compression: options.compression || false,
136137
warnings
137138
}

api/api/cat.tasks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function buildCatTasks (opts) {
131131
maxRetries: options.maxRetries || null,
132132
asStream: options.asStream || false,
133133
headers: options.headers || null,
134+
querystring: options.querystring || null,
134135
compression: options.compression || false,
135136
warnings
136137
}

api/api/cat.templates.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ function buildCatTemplates (opts) {
131131
maxRetries: options.maxRetries || null,
132132
asStream: options.asStream || false,
133133
headers: options.headers || null,
134+
querystring: options.querystring || null,
134135
compression: options.compression || false,
135136
warnings
136137
}

api/api/cat.thread_pool.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ function buildCatThreadPool (opts) {
133133
maxRetries: options.maxRetries || null,
134134
asStream: options.asStream || false,
135135
headers: options.headers || null,
136+
querystring: options.querystring || null,
136137
compression: options.compression || false,
137138
warnings
138139
}

api/api/ccr.delete_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function buildCcrDeleteAutoFollowPattern (opts) {
107107
maxRetries: options.maxRetries || null,
108108
asStream: options.asStream || false,
109109
headers: options.headers || null,
110+
querystring: options.querystring || null,
110111
compression: options.compression || false,
111112
warnings
112113
}

api/api/ccr.follow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function buildCcrFollow (opts) {
115115
maxRetries: options.maxRetries || null,
116116
asStream: options.asStream || false,
117117
headers: options.headers || null,
118+
querystring: options.querystring || null,
118119
compression: options.compression || false,
119120
warnings
120121
}

api/api/ccr.follow_info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function buildCcrFollowInfo (opts) {
9999
maxRetries: options.maxRetries || null,
100100
asStream: options.asStream || false,
101101
headers: options.headers || null,
102+
querystring: options.querystring || null,
102103
compression: options.compression || false,
103104
warnings
104105
}

api/api/ccr.follow_stats.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function buildCcrFollowStats (opts) {
9999
maxRetries: options.maxRetries || null,
100100
asStream: options.asStream || false,
101101
headers: options.headers || null,
102+
querystring: options.querystring || null,
102103
compression: options.compression || false,
103104
warnings
104105
}

api/api/ccr.get_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function buildCcrGetAutoFollowPattern (opts) {
103103
maxRetries: options.maxRetries || null,
104104
asStream: options.asStream || false,
105105
headers: options.headers || null,
106+
querystring: options.querystring || null,
106107
compression: options.compression || false,
107108
warnings
108109
}

api/api/ccr.pause_follow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function buildCcrPauseFollow (opts) {
107107
maxRetries: options.maxRetries || null,
108108
asStream: options.asStream || false,
109109
headers: options.headers || null,
110+
querystring: options.querystring || null,
110111
compression: options.compression || false,
111112
warnings
112113
}

api/api/ccr.put_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function buildCcrPutAutoFollowPattern (opts) {
114114
maxRetries: options.maxRetries || null,
115115
asStream: options.asStream || false,
116116
headers: options.headers || null,
117+
querystring: options.querystring || null,
117118
compression: options.compression || false,
118119
warnings
119120
}

api/api/ccr.resume_follow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ function buildCcrResumeFollow (opts) {
108108
maxRetries: options.maxRetries || null,
109109
asStream: options.asStream || false,
110110
headers: options.headers || null,
111+
querystring: options.querystring || null,
111112
compression: options.compression || false,
112113
warnings
113114
}

api/api/ccr.stats.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function buildCcrStats (opts) {
9898
maxRetries: options.maxRetries || null,
9999
asStream: options.asStream || false,
100100
headers: options.headers || null,
101+
querystring: options.querystring || null,
101102
compression: options.compression || false,
102103
warnings
103104
}

api/api/ccr.unfollow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function buildCcrUnfollow (opts) {
107107
maxRetries: options.maxRetries || null,
108108
asStream: options.asStream || false,
109109
headers: options.headers || null,
110+
querystring: options.querystring || null,
110111
compression: options.compression || false,
111112
warnings
112113
}

api/api/clear_scroll.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ function buildClearScroll (opts) {
109109
maxRetries: options.maxRetries || null,
110110
asStream: options.asStream || false,
111111
headers: options.headers || null,
112+
querystring: options.querystring || null,
112113
compression: options.compression || false,
113114
warnings
114115
}

api/api/cluster.allocation_explain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function buildClusterAllocationExplain (opts) {
110110
maxRetries: options.maxRetries || null,
111111
asStream: options.asStream || false,
112112
headers: options.headers || null,
113+
querystring: options.querystring || null,
113114
compression: options.compression || false,
114115
warnings
115116
}

api/api/cluster.get_settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildClusterGetSettings (opts) {
122122
maxRetries: options.maxRetries || null,
123123
asStream: options.asStream || false,
124124
headers: options.headers || null,
125+
querystring: options.querystring || null,
125126
compression: options.compression || false,
126127
warnings
127128
}

api/api/cluster.health.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ function buildClusterHealth (opts) {
143143
maxRetries: options.maxRetries || null,
144144
asStream: options.asStream || false,
145145
headers: options.headers || null,
146+
querystring: options.querystring || null,
146147
compression: options.compression || false,
147148
warnings
148149
}

api/api/cluster.pending_tasks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ function buildClusterPendingTasks (opts) {
116116
maxRetries: options.maxRetries || null,
117117
asStream: options.asStream || false,
118118
headers: options.headers || null,
119+
querystring: options.querystring || null,
119120
compression: options.compression || false,
120121
warnings
121122
}

api/api/cluster.put_settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function buildClusterPutSettings (opts) {
120120
maxRetries: options.maxRetries || null,
121121
asStream: options.asStream || false,
122122
headers: options.headers || null,
123+
querystring: options.querystring || null,
123124
compression: options.compression || false,
124125
warnings
125126
}

api/api/cluster.remote_info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function buildClusterRemoteInfo (opts) {
111111
maxRetries: options.maxRetries || null,
112112
asStream: options.asStream || false,
113113
headers: options.headers || null,
114+
querystring: options.querystring || null,
114115
compression: options.compression || false,
115116
warnings
116117
}

api/api/cluster.reroute.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function buildClusterReroute (opts) {
119119
maxRetries: options.maxRetries || null,
120120
asStream: options.asStream || false,
121121
headers: options.headers || null,
122+
querystring: options.querystring || null,
122123
compression: options.compression || false,
123124
warnings
124125
}

api/api/cluster.state.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ function buildClusterState (opts) {
150150
maxRetries: options.maxRetries || null,
151151
asStream: options.asStream || false,
152152
headers: options.headers || null,
153+
querystring: options.querystring || null,
153154
compression: options.compression || false,
154155
warnings
155156
}

api/api/cluster.stats.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function buildClusterStats (opts) {
121121
maxRetries: options.maxRetries || null,
122122
asStream: options.asStream || false,
123123
headers: options.headers || null,
124+
querystring: options.querystring || null,
124125
compression: options.compression || false,
125126
warnings
126127
}

api/api/count.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ function buildCount (opts) {
156156
maxRetries: options.maxRetries || null,
157157
asStream: options.asStream || false,
158158
headers: options.headers || null,
159+
querystring: options.querystring || null,
159160
compression: options.compression || false,
160161
warnings
161162
}

api/api/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ function buildCreate (opts) {
149149
maxRetries: options.maxRetries || null,
150150
asStream: options.asStream || false,
151151
headers: options.headers || null,
152+
querystring: options.querystring || null,
152153
compression: options.compression || false,
153154
warnings
154155
}

api/api/delete.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ function buildDelete (opts) {
160160
maxRetries: options.maxRetries || null,
161161
asStream: options.asStream || false,
162162
headers: options.headers || null,
163+
querystring: options.querystring || null,
163164
compression: options.compression || false,
164165
warnings
165166
}

api/api/delete_by_query.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ function buildDeleteByQuery (opts) {
211211
maxRetries: options.maxRetries || null,
212212
asStream: options.asStream || false,
213213
headers: options.headers || null,
214+
querystring: options.querystring || null,
214215
compression: options.compression || false,
215216
warnings
216217
}

api/api/delete_by_query_rethrottle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ function buildDeleteByQueryRethrottle (opts) {
127127
maxRetries: options.maxRetries || null,
128128
asStream: options.asStream || false,
129129
headers: options.headers || null,
130+
querystring: options.querystring || null,
130131
compression: options.compression || false,
131132
warnings
132133
}

api/api/delete_script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function buildDeleteScript (opts) {
123123
maxRetries: options.maxRetries || null,
124124
asStream: options.asStream || false,
125125
headers: options.headers || null,
126+
querystring: options.querystring || null,
126127
compression: options.compression || false,
127128
warnings
128129
}

api/api/exists.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ function buildExists (opts) {
156156
maxRetries: options.maxRetries || null,
157157
asStream: options.asStream || false,
158158
headers: options.headers || null,
159+
querystring: options.querystring || null,
159160
compression: options.compression || false,
160161
warnings
161162
}

0 commit comments

Comments
 (0)