@lowdefy/connection-elasticsearch 4.0.0-alpha.1 → 4.0.0-alpha.12
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.
- package/dist/connections/Elasticsearch/Elasticsearch.js +3 -4
- package/dist/connections/Elasticsearch/ElasticsearchDelete/ElasticsearchDelete.js +9 -3
- package/dist/connections/Elasticsearch/ElasticsearchDelete/schema.js +101 -0
- package/dist/connections/Elasticsearch/ElasticsearchDeleteByQuery/ElasticsearchDeleteByQuery.js +9 -3
- package/dist/connections/Elasticsearch/ElasticsearchDeleteByQuery/schema.js +245 -0
- package/dist/connections/Elasticsearch/ElasticsearchIndex/ElasticsearchIndex.js +9 -3
- package/dist/connections/Elasticsearch/ElasticsearchIndex/schema.js +114 -0
- package/dist/connections/Elasticsearch/ElasticsearchSearch/ElasticsearchSearch.js +11 -8
- package/dist/connections/Elasticsearch/ElasticsearchSearch/schema.js +452 -0
- package/dist/connections/Elasticsearch/ElasticsearchUpdate/ElasticsearchUpdate.js +9 -3
- package/dist/connections/Elasticsearch/ElasticsearchUpdate/schema.js +201 -0
- package/dist/connections/Elasticsearch/ElasticsearchUpdateByQuery/ElasticsearchUpdateByQuery.js +9 -3
- package/dist/connections/Elasticsearch/ElasticsearchUpdateByQuery/schema.js +254 -0
- package/dist/connections/Elasticsearch/schema.js +471 -0
- package/dist/{connections/Elasticsearch/ElasticsearchIndex/index.js → connections.js} +2 -11
- package/dist/{connections/Elasticsearch/ElasticsearchDelete/index.js → types.js} +7 -11
- package/package.json +13 -12
- package/dist/connections/Elasticsearch/ElasticsearchDelete/ElasticsearchDelete.json +0 -87
- package/dist/connections/Elasticsearch/ElasticsearchDeleteByQuery/ElasticsearchDeleteByQuery.json +0 -231
- package/dist/connections/Elasticsearch/ElasticsearchDeleteByQuery/index.js +0 -24
- package/dist/connections/Elasticsearch/ElasticsearchIndex/ElasticsearchIndex.json +0 -100
- package/dist/connections/Elasticsearch/ElasticsearchSchema.json +0 -457
- package/dist/connections/Elasticsearch/ElasticsearchSearch/ElasticsearchSearch.json +0 -380
- package/dist/connections/Elasticsearch/ElasticsearchSearch/index.js +0 -24
- package/dist/connections/Elasticsearch/ElasticsearchUpdate/ElasticsearchUpdate.json +0 -187
- package/dist/connections/Elasticsearch/ElasticsearchUpdate/index.js +0 -24
- package/dist/connections/Elasticsearch/ElasticsearchUpdateByQuery/ElasticsearchUpdateByQuery.json +0 -240
- package/dist/connections/Elasticsearch/ElasticsearchUpdateByQuery/index.js +0 -24
- package/dist/index.js +0 -7
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
17
|
+
title: 'Lowdefy Request Schema - ElasticsearchSearch',
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
body: {
|
|
21
|
+
type: 'object',
|
|
22
|
+
description: 'The search definition using the Query DSL.',
|
|
23
|
+
properties: {
|
|
24
|
+
query: {
|
|
25
|
+
$ref: '#/definitions/Query'
|
|
26
|
+
},
|
|
27
|
+
aggs: {
|
|
28
|
+
description: 'The aggregations to request for the search.',
|
|
29
|
+
type: 'object'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
_source: {
|
|
34
|
+
description: 'True or false to return the _source field or not, or a list of fields to return.',
|
|
35
|
+
examples: [
|
|
36
|
+
[
|
|
37
|
+
'id',
|
|
38
|
+
'name'
|
|
39
|
+
],
|
|
40
|
+
'name',
|
|
41
|
+
true,
|
|
42
|
+
false
|
|
43
|
+
],
|
|
44
|
+
anyOf: [
|
|
45
|
+
{
|
|
46
|
+
items: {
|
|
47
|
+
type: 'string'
|
|
48
|
+
},
|
|
49
|
+
type: 'array'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'string'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: 'boolean'
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
_source_exclude: {
|
|
60
|
+
description: 'A list of fields to exclude from the returned _source field.',
|
|
61
|
+
examples: [
|
|
62
|
+
[
|
|
63
|
+
'id',
|
|
64
|
+
'name'
|
|
65
|
+
],
|
|
66
|
+
'name'
|
|
67
|
+
],
|
|
68
|
+
anyOf: [
|
|
69
|
+
{
|
|
70
|
+
items: {
|
|
71
|
+
type: 'string'
|
|
72
|
+
},
|
|
73
|
+
type: 'array'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'string'
|
|
77
|
+
},
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
_source_excludes: {
|
|
81
|
+
description: 'A list of fields to exclude from the returned _source field.',
|
|
82
|
+
examples: [
|
|
83
|
+
[
|
|
84
|
+
'id',
|
|
85
|
+
'name'
|
|
86
|
+
],
|
|
87
|
+
'name'
|
|
88
|
+
],
|
|
89
|
+
anyOf: [
|
|
90
|
+
{
|
|
91
|
+
items: {
|
|
92
|
+
type: 'string'
|
|
93
|
+
},
|
|
94
|
+
type: 'array'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'string'
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
_source_include: {
|
|
102
|
+
description: 'A list of fields to extract and return from the _source field.',
|
|
103
|
+
examples: [
|
|
104
|
+
[
|
|
105
|
+
'id',
|
|
106
|
+
'name'
|
|
107
|
+
],
|
|
108
|
+
'name'
|
|
109
|
+
],
|
|
110
|
+
anyOf: [
|
|
111
|
+
{
|
|
112
|
+
items: {
|
|
113
|
+
type: 'string'
|
|
114
|
+
},
|
|
115
|
+
type: 'array'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
type: 'string'
|
|
119
|
+
},
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
_source_includes: {
|
|
123
|
+
description: 'A list of fields to extract and return from the _source field.',
|
|
124
|
+
examples: [
|
|
125
|
+
[
|
|
126
|
+
'id',
|
|
127
|
+
'name'
|
|
128
|
+
],
|
|
129
|
+
'name'
|
|
130
|
+
],
|
|
131
|
+
anyOf: [
|
|
132
|
+
{
|
|
133
|
+
items: {
|
|
134
|
+
type: 'string'
|
|
135
|
+
},
|
|
136
|
+
type: 'array'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: 'string'
|
|
140
|
+
},
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
allow_no_indices: {
|
|
144
|
+
description: 'Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified).',
|
|
145
|
+
type: 'boolean'
|
|
146
|
+
},
|
|
147
|
+
allow_partial_search_results: {
|
|
148
|
+
description: 'Indicate if an error should be returned if there is a partial search failure or timeout.',
|
|
149
|
+
type: 'boolean',
|
|
150
|
+
default: true
|
|
151
|
+
},
|
|
152
|
+
analyze_wildcard: {
|
|
153
|
+
description: 'Specify whether wildcard and prefix queries should be analyzed.',
|
|
154
|
+
type: 'boolean',
|
|
155
|
+
default: false
|
|
156
|
+
},
|
|
157
|
+
analyzer: {
|
|
158
|
+
description: 'The analyzer to use for the query string.',
|
|
159
|
+
type: 'string'
|
|
160
|
+
},
|
|
161
|
+
batched_reduce_size: {
|
|
162
|
+
description: 'The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.',
|
|
163
|
+
type: 'number',
|
|
164
|
+
default: 512
|
|
165
|
+
},
|
|
166
|
+
ccs_minimize_roundtrips: {
|
|
167
|
+
description: 'Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution.',
|
|
168
|
+
type: 'boolean',
|
|
169
|
+
default: true
|
|
170
|
+
},
|
|
171
|
+
default_operator: {
|
|
172
|
+
description: 'The default operator for query string query (AND or OR).',
|
|
173
|
+
enum: [
|
|
174
|
+
'AND',
|
|
175
|
+
'OR'
|
|
176
|
+
],
|
|
177
|
+
type: 'string',
|
|
178
|
+
default: 'OR'
|
|
179
|
+
},
|
|
180
|
+
df: {
|
|
181
|
+
description: 'The field to use as default where no field prefix is given in the query string.',
|
|
182
|
+
type: 'string'
|
|
183
|
+
},
|
|
184
|
+
docvalue_fields: {
|
|
185
|
+
description: 'A comma-separated list of fields to return as the docvalue representation of a field for each hit.',
|
|
186
|
+
anyOf: [
|
|
187
|
+
{
|
|
188
|
+
items: {
|
|
189
|
+
type: 'string'
|
|
190
|
+
},
|
|
191
|
+
type: 'array'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'string'
|
|
195
|
+
},
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
error_trace: {
|
|
199
|
+
description: 'Include the stack trace of returned errors.',
|
|
200
|
+
type: 'boolean'
|
|
201
|
+
},
|
|
202
|
+
expand_wildcards: {
|
|
203
|
+
description: 'Whether to expand wildcard expression to concrete indices that are open, closed or both.',
|
|
204
|
+
enum: [
|
|
205
|
+
'all',
|
|
206
|
+
'closed',
|
|
207
|
+
'hidden',
|
|
208
|
+
'none',
|
|
209
|
+
'open'
|
|
210
|
+
],
|
|
211
|
+
type: 'string',
|
|
212
|
+
default: 'open'
|
|
213
|
+
},
|
|
214
|
+
explain: {
|
|
215
|
+
description: 'Specify whether to return detailed information about score computation as part of a hit.',
|
|
216
|
+
type: 'boolean'
|
|
217
|
+
},
|
|
218
|
+
from: {
|
|
219
|
+
description: 'Starting offset.',
|
|
220
|
+
type: 'number',
|
|
221
|
+
default: 0
|
|
222
|
+
},
|
|
223
|
+
human: {
|
|
224
|
+
description: 'Return human readable values for statistics.',
|
|
225
|
+
type: 'boolean',
|
|
226
|
+
default: true
|
|
227
|
+
},
|
|
228
|
+
ignore_throttled: {
|
|
229
|
+
description: 'Whether specified concrete, expanded or aliased indices should be ignored when throttled.',
|
|
230
|
+
type: 'boolean'
|
|
231
|
+
},
|
|
232
|
+
ignore_unavailable: {
|
|
233
|
+
description: 'Whether specified concrete indices should be ignored when unavailable (missing or closed)',
|
|
234
|
+
type: 'boolean'
|
|
235
|
+
},
|
|
236
|
+
index: {
|
|
237
|
+
description: 'A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices.',
|
|
238
|
+
anyOf: [
|
|
239
|
+
{
|
|
240
|
+
items: {
|
|
241
|
+
type: 'string'
|
|
242
|
+
},
|
|
243
|
+
type: 'array'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
type: 'string'
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
examples: [
|
|
250
|
+
'',
|
|
251
|
+
'_all',
|
|
252
|
+
'my_index'
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
lenient: {
|
|
256
|
+
description: 'Specify whether format-based query failures (such as providing text to a numeric field) should be ignored.',
|
|
257
|
+
type: 'boolean'
|
|
258
|
+
},
|
|
259
|
+
max_concurrent_shard_requests: {
|
|
260
|
+
description: 'The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.',
|
|
261
|
+
type: 'number',
|
|
262
|
+
default: 5
|
|
263
|
+
},
|
|
264
|
+
min_compatible_shard_node: {
|
|
265
|
+
description: 'The minimum compatible version that all shards involved in search should have for this request to be successful.',
|
|
266
|
+
type: 'string'
|
|
267
|
+
},
|
|
268
|
+
pre_filter_shard_size: {
|
|
269
|
+
description: 'A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.',
|
|
270
|
+
type: 'number'
|
|
271
|
+
},
|
|
272
|
+
preference: {
|
|
273
|
+
description: 'Specify the node or shard the operation should be performed on.',
|
|
274
|
+
type: 'string',
|
|
275
|
+
default: 'random'
|
|
276
|
+
},
|
|
277
|
+
pretty: {
|
|
278
|
+
description: 'Pretty format the returned JSON response.',
|
|
279
|
+
type: 'boolean'
|
|
280
|
+
},
|
|
281
|
+
q: {
|
|
282
|
+
description: 'Query in the Lucene query string syntax.',
|
|
283
|
+
type: 'string'
|
|
284
|
+
},
|
|
285
|
+
request_cache: {
|
|
286
|
+
description: 'Specify if request cache should be used for this request or not, defaults to index level setting.',
|
|
287
|
+
type: 'boolean'
|
|
288
|
+
},
|
|
289
|
+
rest_total_hits_as_int: {
|
|
290
|
+
description: 'Indicates whether hits.total should be rendered as an integer or an object in the rest search response.',
|
|
291
|
+
type: 'boolean'
|
|
292
|
+
},
|
|
293
|
+
routing: {
|
|
294
|
+
description: 'A comma-separated list of specific routing values.',
|
|
295
|
+
anyOf: [
|
|
296
|
+
{
|
|
297
|
+
items: {
|
|
298
|
+
type: 'string'
|
|
299
|
+
},
|
|
300
|
+
type: 'array'
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
type: 'string'
|
|
304
|
+
},
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
scroll: {
|
|
308
|
+
description: 'Specify how long a consistent view of the index should be maintained for scrolled search.',
|
|
309
|
+
type: 'string'
|
|
310
|
+
},
|
|
311
|
+
search_type: {
|
|
312
|
+
description: 'Search operation type.',
|
|
313
|
+
enum: [
|
|
314
|
+
'dfs_query_then_fetch',
|
|
315
|
+
'query_then_fetch'
|
|
316
|
+
],
|
|
317
|
+
type: 'string'
|
|
318
|
+
},
|
|
319
|
+
seq_no_primary_term: {
|
|
320
|
+
description: 'Specify whether to return sequence number and primary term of the last modification of each hit',
|
|
321
|
+
type: 'boolean'
|
|
322
|
+
},
|
|
323
|
+
size: {
|
|
324
|
+
description: 'Number of hits to return.',
|
|
325
|
+
type: 'number',
|
|
326
|
+
default: 10
|
|
327
|
+
},
|
|
328
|
+
sort: {
|
|
329
|
+
description: 'A comma-separated list of <field>:<direction> pairs.',
|
|
330
|
+
examples: [
|
|
331
|
+
'name:asc',
|
|
332
|
+
[
|
|
333
|
+
'rating:asc',
|
|
334
|
+
'created_at:desc'
|
|
335
|
+
]
|
|
336
|
+
],
|
|
337
|
+
anyOf: [
|
|
338
|
+
{
|
|
339
|
+
items: {
|
|
340
|
+
type: 'string'
|
|
341
|
+
},
|
|
342
|
+
type: 'array'
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
type: 'string'
|
|
346
|
+
},
|
|
347
|
+
]
|
|
348
|
+
},
|
|
349
|
+
source: {
|
|
350
|
+
description: 'The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.',
|
|
351
|
+
type: 'string'
|
|
352
|
+
},
|
|
353
|
+
stats: {
|
|
354
|
+
description: 'Specific tag of the request for logging and statistical purposes',
|
|
355
|
+
anyOf: [
|
|
356
|
+
{
|
|
357
|
+
items: {
|
|
358
|
+
type: 'string'
|
|
359
|
+
},
|
|
360
|
+
type: 'array'
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
type: 'string'
|
|
364
|
+
},
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
stored_fields: {
|
|
368
|
+
description: 'A comma-separated list of stored fields to return as part of a hit',
|
|
369
|
+
anyOf: [
|
|
370
|
+
{
|
|
371
|
+
items: {
|
|
372
|
+
type: 'string'
|
|
373
|
+
},
|
|
374
|
+
type: 'array'
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: 'string'
|
|
378
|
+
},
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
suggest_field: {
|
|
382
|
+
description: 'Specify which field to use for suggestions',
|
|
383
|
+
type: 'string'
|
|
384
|
+
},
|
|
385
|
+
suggest_mode: {
|
|
386
|
+
description: 'Specify suggest mode',
|
|
387
|
+
enum: [
|
|
388
|
+
'always',
|
|
389
|
+
'missing',
|
|
390
|
+
'popular'
|
|
391
|
+
],
|
|
392
|
+
type: 'string',
|
|
393
|
+
default: 'missing'
|
|
394
|
+
},
|
|
395
|
+
suggest_size: {
|
|
396
|
+
description: 'How many suggestions to return in response',
|
|
397
|
+
type: 'number'
|
|
398
|
+
},
|
|
399
|
+
suggest_text: {
|
|
400
|
+
description: 'The source text for which the suggestions should be returned.',
|
|
401
|
+
type: 'string'
|
|
402
|
+
},
|
|
403
|
+
terminate_after: {
|
|
404
|
+
description: 'The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.',
|
|
405
|
+
type: 'number'
|
|
406
|
+
},
|
|
407
|
+
timeout: {
|
|
408
|
+
description: 'Explicit operation timeout.',
|
|
409
|
+
type: 'string'
|
|
410
|
+
},
|
|
411
|
+
track_scores: {
|
|
412
|
+
description: 'Whether to calculate and return scores even if they are not used for sorting.',
|
|
413
|
+
type: 'boolean'
|
|
414
|
+
},
|
|
415
|
+
track_total_hits: {
|
|
416
|
+
description: 'Indicate if the number of documents that match the query should be tracked.',
|
|
417
|
+
type: 'boolean'
|
|
418
|
+
},
|
|
419
|
+
type: {
|
|
420
|
+
description: 'A comma-separated list of document types to search; leave empty to perform the operation on all types.',
|
|
421
|
+
anyOf: [
|
|
422
|
+
{
|
|
423
|
+
items: {
|
|
424
|
+
type: 'string'
|
|
425
|
+
},
|
|
426
|
+
type: 'array'
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
type: 'string'
|
|
430
|
+
},
|
|
431
|
+
]
|
|
432
|
+
},
|
|
433
|
+
typed_keys: {
|
|
434
|
+
description: 'Specify whether aggregation and suggester names should be prefixed by their respective types in the response.',
|
|
435
|
+
type: 'boolean'
|
|
436
|
+
},
|
|
437
|
+
version: {
|
|
438
|
+
description: 'Specify whether to return document version as part of a hit',
|
|
439
|
+
type: 'boolean'
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
definitions: {
|
|
443
|
+
Query: {
|
|
444
|
+
description: 'A query expressed in the Elasticsearch query DSL. See https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html.',
|
|
445
|
+
type: 'object',
|
|
446
|
+
additionalProperties: true
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
errorMessage: {
|
|
450
|
+
type: 'ElasticsearchSearch request properties should be an object.'
|
|
451
|
+
}
|
|
452
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { Client } from '@elastic/elasticsearch';
|
|
16
|
-
|
|
16
|
+
import schema from './schema.js';
|
|
17
|
+
async function ElasticsearchUpdate({ request , connection }) {
|
|
17
18
|
const client = new Client(connection);
|
|
18
19
|
const { body: response } = await client.update({
|
|
19
20
|
...request,
|
|
@@ -24,4 +25,9 @@ async function elasticsearchUpdate({ request , connection }) {
|
|
|
24
25
|
response
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
ElasticsearchUpdate.schema = schema;
|
|
29
|
+
ElasticsearchUpdate.meta = {
|
|
30
|
+
checkRead: false,
|
|
31
|
+
checkWrite: true
|
|
32
|
+
};
|
|
33
|
+
export default ElasticsearchUpdate;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ export default {
|
|
16
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
17
|
+
title: 'Lowdefy Request Schema - ElasticsearchUpdate',
|
|
18
|
+
type: 'object',
|
|
19
|
+
description: 'Updates a document using the specified script.',
|
|
20
|
+
required: [
|
|
21
|
+
'id',
|
|
22
|
+
'body'
|
|
23
|
+
],
|
|
24
|
+
properties: {
|
|
25
|
+
id: {
|
|
26
|
+
anyOf: [
|
|
27
|
+
{
|
|
28
|
+
type: 'string'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'number'
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
description: 'Unique identifier for the document to be updated.'
|
|
35
|
+
},
|
|
36
|
+
index: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: "Name of the target index. By default, the index is created automatically if it doesn't exist. For more information, see Automatically create data streams and indices."
|
|
39
|
+
},
|
|
40
|
+
if_seq_no: {
|
|
41
|
+
type: 'integer',
|
|
42
|
+
description: 'Only perform the operation if the document has this sequence number. See Optimistic concurrency control.'
|
|
43
|
+
},
|
|
44
|
+
if_primary_term: {
|
|
45
|
+
type: 'integer',
|
|
46
|
+
description: 'Only perform the operation if the document has this primary term. See Optimistic concurrency control.'
|
|
47
|
+
},
|
|
48
|
+
require_alias: {
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
description: 'If true, the destination must be an index alias. Defaults to false.',
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
refresh: {
|
|
54
|
+
anyOf: [
|
|
55
|
+
{
|
|
56
|
+
type: 'string'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'boolean'
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
description: 'If true, Elasticsearch refreshes the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false do nothing with refreshes. Valid values: true, false, wait_for. Default: false.',
|
|
63
|
+
enum: [
|
|
64
|
+
'true',
|
|
65
|
+
'false',
|
|
66
|
+
true,
|
|
67
|
+
false,
|
|
68
|
+
'wait_for'
|
|
69
|
+
],
|
|
70
|
+
default: false
|
|
71
|
+
},
|
|
72
|
+
retry_on_conflict: {
|
|
73
|
+
type: 'integer',
|
|
74
|
+
description: 'Specify how many times should the operation be retried when a conflict occurs. Default: 0.',
|
|
75
|
+
default: 0
|
|
76
|
+
},
|
|
77
|
+
routing: {
|
|
78
|
+
description: 'Custom value used to route operations to a specific shard.',
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
_source: {
|
|
82
|
+
anyOf: [
|
|
83
|
+
{
|
|
84
|
+
type: 'boolean'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'array'
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
items: {
|
|
91
|
+
type: 'string'
|
|
92
|
+
},
|
|
93
|
+
description: 'Set to false to disable source retrieval (default: true). You can also specify a comma-separated list of the fields you want to retrieve.',
|
|
94
|
+
default: true
|
|
95
|
+
},
|
|
96
|
+
_source_excludes: {
|
|
97
|
+
type: 'array',
|
|
98
|
+
items: {
|
|
99
|
+
type: 'string'
|
|
100
|
+
},
|
|
101
|
+
description: 'Specify the source fields you want to exclude.'
|
|
102
|
+
},
|
|
103
|
+
_source_includes: {
|
|
104
|
+
type: 'array',
|
|
105
|
+
items: {
|
|
106
|
+
type: 'string'
|
|
107
|
+
},
|
|
108
|
+
description: 'Specify the source fields you want to include.'
|
|
109
|
+
},
|
|
110
|
+
timeout: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'Period to wait for the following operations:\n\nDynamic mapping updates\nWaiting for active shards\nDefaults to 1m (one minute). This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.',
|
|
113
|
+
default: '1m'
|
|
114
|
+
},
|
|
115
|
+
wait_for_active_shards: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Default: 1, the primary shard.',
|
|
118
|
+
default: '1'
|
|
119
|
+
},
|
|
120
|
+
body: {
|
|
121
|
+
description: 'The request definition requires either script or partial doc.',
|
|
122
|
+
anyOf: [
|
|
123
|
+
{
|
|
124
|
+
required: [
|
|
125
|
+
'doc'
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
required: [
|
|
130
|
+
'script'
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
properties: {
|
|
135
|
+
doc: {
|
|
136
|
+
additionalProperties: true,
|
|
137
|
+
description: 'Partial document to update'
|
|
138
|
+
},
|
|
139
|
+
script: {
|
|
140
|
+
$ref: '#/definitions/Script'
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
errorMessage: {
|
|
144
|
+
anyOf: 'ElasticsearchUpdate request should have required property "body.doc" or "body.script".'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
definitions: {
|
|
149
|
+
Script: {
|
|
150
|
+
description: 'An Elasticsearch script.',
|
|
151
|
+
additionalProperties: false,
|
|
152
|
+
anyOf: [
|
|
153
|
+
{
|
|
154
|
+
required: [
|
|
155
|
+
'source'
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
required: [
|
|
160
|
+
'id'
|
|
161
|
+
]
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
properties: {
|
|
165
|
+
lang: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
enum: [
|
|
168
|
+
'painless',
|
|
169
|
+
'expression',
|
|
170
|
+
'mustache',
|
|
171
|
+
'java'
|
|
172
|
+
],
|
|
173
|
+
description: 'Specifies the language the script is written in. Defaults to painless.',
|
|
174
|
+
default: 'painless'
|
|
175
|
+
},
|
|
176
|
+
source: {
|
|
177
|
+
description: 'The script itself, which you specify as source for an inline script.',
|
|
178
|
+
type: 'string'
|
|
179
|
+
},
|
|
180
|
+
id: {
|
|
181
|
+
description: 'The script itself, which you specify as id for a stored script. Use the stored script APIs to create and manage stored scripts.',
|
|
182
|
+
type: 'string'
|
|
183
|
+
},
|
|
184
|
+
params: {
|
|
185
|
+
description: 'Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.',
|
|
186
|
+
type: 'object'
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
errorMessage: {
|
|
190
|
+
anyOf: 'ElasticsearchUpdate request should have required property "body.script.source" or "body.script.id".'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
errorMessage: {
|
|
195
|
+
type: 'ElasticsearchUpdate request properties should be an object.',
|
|
196
|
+
required: {
|
|
197
|
+
id: 'ElasticsearchUpdate request should have required property "id".',
|
|
198
|
+
body: 'ElasticsearchUpdate request should have required property "body".'
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|