Skip to content

Commit 796644f

Browse files
committed
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 2debb7b commit 796644f

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
@@ -140,6 +140,7 @@ function buildBulk (opts) {
140140
maxRetries: options.maxRetries || null,
141141
asStream: options.asStream || false,
142142
headers: options.headers || null,
143+
querystring: options.querystring || null,
143144
compression: options.compression || false,
144145
warnings
145146
}

api/api/cat.aliases.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildCatAliases (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/cat.allocation.js

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

api/api/cat.count.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildCatCount (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/cat.fielddata.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function buildCatFielddata (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.health.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function buildCatHealth (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/cat.help.js

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

api/api/cat.indices.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function buildCatIndices (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.master.js

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

api/api/cat.nodeattrs.js

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

api/api/cat.nodes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function buildCatNodes (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/cat.pending_tasks.js

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

api/api/cat.plugins.js

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

api/api/cat.recovery.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildCatRecovery (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/cat.repositories.js

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

api/api/cat.segments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function buildCatSegments (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/cat.shards.js

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

api/api/cat.snapshots.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function buildCatSnapshots (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/cat.tasks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildCatTasks (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/cat.templates.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function buildCatTemplates (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/cat.thread_pool.js

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

api/api/ccr.delete_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function buildCcrDeleteAutoFollowPattern (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.follow.js

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

api/api/ccr.follow_info.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function buildCcrFollowInfo (opts) {
9090
maxRetries: options.maxRetries || null,
9191
asStream: options.asStream || false,
9292
headers: options.headers || null,
93+
querystring: options.querystring || null,
9394
compression: options.compression || false,
9495
warnings
9596
}

api/api/ccr.follow_stats.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function buildCcrFollowStats (opts) {
9090
maxRetries: options.maxRetries || null,
9191
asStream: options.asStream || false,
9292
headers: options.headers || null,
93+
querystring: options.querystring || null,
9394
compression: options.compression || false,
9495
warnings
9596
}

api/api/ccr.get_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function buildCcrGetAutoFollowPattern (opts) {
9494
maxRetries: options.maxRetries || null,
9595
asStream: options.asStream || false,
9696
headers: options.headers || null,
97+
querystring: options.querystring || null,
9798
compression: options.compression || false,
9899
warnings
99100
}

api/api/ccr.pause_follow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function buildCcrPauseFollow (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.put_auto_follow_pattern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ function buildCcrPutAutoFollowPattern (opts) {
105105
maxRetries: options.maxRetries || null,
106106
asStream: options.asStream || false,
107107
headers: options.headers || null,
108+
querystring: options.querystring || null,
108109
compression: options.compression || false,
109110
warnings
110111
}

api/api/ccr.resume_follow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function buildCcrResumeFollow (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.stats.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function buildCcrStats (opts) {
8989
maxRetries: options.maxRetries || null,
9090
asStream: options.asStream || false,
9191
headers: options.headers || null,
92+
querystring: options.querystring || null,
9293
compression: options.compression || false,
9394
warnings
9495
}

api/api/ccr.unfollow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ function buildCcrUnfollow (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/clear_scroll.js

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

api/api/cluster.allocation_explain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ function buildClusterAllocationExplain (opts) {
101101
maxRetries: options.maxRetries || null,
102102
asStream: options.asStream || false,
103103
headers: options.headers || null,
104+
querystring: options.querystring || null,
104105
compression: options.compression || false,
105106
warnings
106107
}

api/api/cluster.get_settings.js

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

api/api/cluster.health.js

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

api/api/cluster.pending_tasks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function buildClusterPendingTasks (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/cluster.put_settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function buildClusterPutSettings (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.remote_info.js

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

api/api/cluster.reroute.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function buildClusterReroute (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.state.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function buildClusterState (opts) {
141141
maxRetries: options.maxRetries || null,
142142
asStream: options.asStream || false,
143143
headers: options.headers || null,
144+
querystring: options.querystring || null,
144145
compression: options.compression || false,
145146
warnings
146147
}

api/api/cluster.stats.js

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

api/api/count.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ function buildCount (opts) {
147147
maxRetries: options.maxRetries || null,
148148
asStream: options.asStream || false,
149149
headers: options.headers || null,
150+
querystring: options.querystring || null,
150151
compression: options.compression || false,
151152
warnings
152153
}

api/api/create.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ function buildCreate (opts) {
140140
maxRetries: options.maxRetries || null,
141141
asStream: options.asStream || false,
142142
headers: options.headers || null,
143+
querystring: options.querystring || null,
143144
compression: options.compression || false,
144145
warnings
145146
}

api/api/delete.js

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

api/api/delete_by_query.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ function buildDeleteByQuery (opts) {
202202
maxRetries: options.maxRetries || null,
203203
asStream: options.asStream || false,
204204
headers: options.headers || null,
205+
querystring: options.querystring || null,
205206
compression: options.compression || false,
206207
warnings
207208
}

api/api/delete_by_query_rethrottle.js

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

api/api/delete_script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function buildDeleteScript (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/exists.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ function buildExists (opts) {
147147
maxRetries: options.maxRetries || null,
148148
asStream: options.asStream || false,
149149
headers: options.headers || null,
150+
querystring: options.querystring || null,
150151
compression: options.compression || false,
151152
warnings
152153
}

0 commit comments

Comments
 (0)