@lowdefy/connection-elasticsearch 4.0.0-alpha.28 → 4.0.0-alpha.29

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.
@@ -1,201 +0,0 @@
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
- };
@@ -1,32 +0,0 @@
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
- */ import { Client } from '@elastic/elasticsearch';
16
- import schema from './schema.js';
17
- async function ElasticsearchUpdateByQuery({ request , connection }) {
18
- const client = new Client(connection);
19
- const { body: response } = await client.updateByQuery({
20
- ...request,
21
- index: request.index || connection.index
22
- });
23
- return {
24
- response
25
- };
26
- }
27
- ElasticsearchUpdateByQuery.schema = schema;
28
- ElasticsearchUpdateByQuery.meta = {
29
- checkRead: false,
30
- checkWrite: true
31
- };
32
- export default ElasticsearchUpdateByQuery;
@@ -1,254 +0,0 @@
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 - ElasticsearchUpdateByQuery',
18
- type: 'object',
19
- description: 'Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.',
20
- properties: {
21
- index: {
22
- type: 'string',
23
- description: 'The name of the index.'
24
- },
25
- allow_no_indices: {
26
- type: 'boolean',
27
- description: 'If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.',
28
- default: true
29
- },
30
- analyzer: {
31
- description: 'The analyzer to use for the query string.',
32
- type: 'string'
33
- },
34
- analyze_wildcard: {
35
- description: 'Specify whether wildcard and prefix queries should be analyzed.',
36
- type: 'boolean',
37
- default: false
38
- },
39
- conflicts: {
40
- type: 'string',
41
- enum: [
42
- 'abort',
43
- 'proceed'
44
- ],
45
- description: 'What to do if update by query hits version conflicts: abort or proceed. Defaults to abort.',
46
- default: 'abort'
47
- },
48
- default_operator: {
49
- description: 'The default operator for query string query (AND or OR).',
50
- enum: [
51
- 'AND',
52
- 'OR'
53
- ],
54
- type: 'string',
55
- default: 'OR'
56
- },
57
- df: {
58
- description: 'The field to use as default where no field prefix is given in the query string.',
59
- type: 'string'
60
- },
61
- expand_wildcards: {
62
- description: 'Whether to expand wildcard expression to concrete indices that are open, closed or both.',
63
- enum: [
64
- 'all',
65
- 'closed',
66
- 'hidden',
67
- 'none',
68
- 'open'
69
- ],
70
- type: 'string',
71
- default: 'open'
72
- },
73
- from: {
74
- description: 'Starting offset.',
75
- type: 'number',
76
- default: 0
77
- },
78
- ignore_unavailable: {
79
- description: 'Whether specified concrete indices should be ignored when unavailable (missing or closed)',
80
- type: 'boolean'
81
- },
82
- lenient: {
83
- description: 'Specify whether format-based query failures (such as providing text to a numeric field) should be ignored.',
84
- type: 'boolean'
85
- },
86
- max_docs: {
87
- type: 'integer',
88
- description: 'Maximum number of documents to process. Defaults to all documents.'
89
- },
90
- pipeline: {
91
- type: 'string',
92
- description: 'ID of the pipeline to use to preprocess incoming documents.'
93
- },
94
- preference: {
95
- description: 'Specify the node or shard the operation should be performed on.',
96
- type: 'string',
97
- default: 'random'
98
- },
99
- pretty: {
100
- description: 'Pretty format the returned JSON response.',
101
- type: 'boolean'
102
- },
103
- q: {
104
- description: 'Query in the Lucene query string syntax.',
105
- type: 'string'
106
- },
107
- request_cache: {
108
- description: 'Specify if request cache should be used for this request or not, defaults to index level setting.',
109
- type: 'boolean'
110
- },
111
- refresh: {
112
- anyOf: [
113
- {
114
- type: 'string'
115
- },
116
- {
117
- type: 'boolean'
118
- },
119
- ],
120
- description: 'If true, Elasticsearch refreshes all shards involved in the delete by query after the request completes. Defaults to false.',
121
- enum: [
122
- 'true',
123
- 'false',
124
- true,
125
- false,
126
- 'wait_for'
127
- ],
128
- default: false
129
- },
130
- requests_per_second: {
131
- type: 'integer',
132
- description: 'The throttle for this request in sub-requests per second. Defaults to -1 (no throttle).',
133
- default: -1
134
- },
135
- routing: {
136
- type: 'string',
137
- description: 'Custom value used to route operations to a specific shard.'
138
- },
139
- scroll: {
140
- type: 'string',
141
- description: 'Period to retain the search context for scrolling. See Scroll search results.'
142
- },
143
- scroll_size: {
144
- type: 'integer',
145
- description: 'Size on the scroll request powering the update by query. Defaults to 100.',
146
- default: 100
147
- },
148
- search_type: {
149
- description: 'Search operation type.',
150
- enum: [
151
- 'dfs_query_then_fetch',
152
- 'query_then_fetch'
153
- ],
154
- type: 'string'
155
- },
156
- search_timeout: {
157
- type: 'string',
158
- description: 'Explicit timeout for each search request. Defaults to no timeout.'
159
- },
160
- slices: {
161
- type: 'integer',
162
- description: "The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks."
163
- },
164
- sort: {
165
- description: 'A comma-separated list of <field>:<direction> pairs.',
166
- examples: [
167
- 'name:asc',
168
- [
169
- 'rating:asc',
170
- 'created_at:desc'
171
- ]
172
- ],
173
- anyOf: [
174
- {
175
- items: {
176
- type: 'string'
177
- },
178
- type: 'array'
179
- },
180
- {
181
- type: 'string'
182
- },
183
- ]
184
- },
185
- _source: {
186
- anyOf: [
187
- {
188
- type: 'boolean'
189
- },
190
- {
191
- type: 'array'
192
- },
193
- ],
194
- items: {
195
- type: 'string'
196
- },
197
- description: 'True or false to return the _source field or not, or a list of fields to return.'
198
- },
199
- _source_excludes: {
200
- type: 'array',
201
- items: {
202
- type: 'string'
203
- },
204
- description: 'A comma-separated list of source fields to exclude from the response.\n\nYou can also use this parameter to exclude fields from the subset specified in _source_includes query parameter.\n\nIf the _source parameter is false, this parameter is ignored.'
205
- },
206
- _source_includes: {
207
- type: 'array',
208
- items: {
209
- type: 'string'
210
- },
211
- description: 'A comma-separated list of source fields to include in the response.\n\nIf this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter.\n\nIf the _source parameter is false, this parameter is ignored.'
212
- },
213
- stats: {
214
- description: 'Specific tag of the request for logging and statistical purposes',
215
- anyOf: [
216
- {
217
- items: {
218
- type: 'string'
219
- },
220
- type: 'array'
221
- },
222
- {
223
- type: 'string'
224
- },
225
- ]
226
- },
227
- terminate_after: {
228
- description: 'The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. Elasticsearch collects documents before sorting.\nUse with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers.',
229
- type: 'number'
230
- },
231
- timeout: {
232
- type: 'string',
233
- description: 'Period each deletion request waits for active shards. Defaults to 1m (one minute).',
234
- default: '1m'
235
- },
236
- version: {
237
- description: 'Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.',
238
- type: 'integer'
239
- },
240
- wait_for_active_shards: {
241
- type: 'string',
242
- 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.',
243
- default: '1'
244
- },
245
- wait_for_completion: {
246
- type: 'boolean',
247
- description: 'Should the request should block until the update by query operation is complete. Default: true',
248
- default: true
249
- }
250
- },
251
- errorMessage: {
252
- type: 'ElasticsearchDelete request properties should be an object.'
253
- }
254
- };