Qore ElasticSearchDataProvider Module Reference 1.0
Loading...
Searching...
No Matches
ElasticSearchIndexTableDataProvider.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
28
39
40public:
42 string name;
43
45 hash<auto> index;
46
48 const ProviderInfo = <DataProviderInfo>{
49 "desc": "ElasticSearch index table data provider; provdes table-like access to an ElasticSearch index; "
50 "fields returned in searches are document properties, plus the special `_id` (document ID) and "
51 "`_score` (query match score) values, which are read-only.\n\n"
52 "Updating and deleting can be performed, but the 'where clause hash` must contain only a single "
53 "`_id` key to identify the document by its ID.\n\n"
54 "Searches are performed with `match`; for more flexible searching, use the index search API data "
55 "provider, `index/search`",
56 "type": "ElasticSearchIndexTableDataProvider",
58 "has_record": True,
59 "supports_read": True,
60 "supports_native_search": True,
61 "supports_update": True,
62 "supports_delete": True,
63 "supports_create": True,
64 "create_options": {
65 "if_seq_no": <DataProviderOptionInfo>{
66 "type": AbstractDataProviderTypeMap."int",
67 "desc": "Only perform the operation if the document has this sequence number",
68 },
69 "if_primary_term": <DataProviderOptionInfo>{
70 "type": AbstractDataProviderTypeMap."int",
71 "desc": "Only perform the operation if the document has this primary term",
72 },
73 "op_type": <DataProviderOptionInfo>{
74 "type": AbstractDataProviderTypeMap."string",
75 "desc": "Set to create to only index the document if it does not already exist (put if absent). If a "
76 "document with the specified `_id` already exists, the indexing operation will fail. Same as "
77 "using the `<index>/_create` endpoint. Valid values: `index`, `create`. If document id is "
78 "specified, it defaults to `index`. Otherwise, it defaults to `create`",
79 },
80 "pipeline": <DataProviderOptionInfo>{
81 "type": AbstractDataProviderTypeMap."string",
82 "desc": "ID of the pipeline to use to preprocess incoming documents. If the index has a default "
83 "ingest pipeline specified, then setting the value to _none disables the default ingest pipeline "
84 "for this request. If a final pipeline is configured it will always run, regardless of the value "
85 "of this parameter",
86 },
87 "refresh": <DataProviderOptionInfo>{
88 "type": AbstractDataProviderTypeMap."string",
89 "desc": "If `true`, Elasticsearch refreshes the affected shards to make this operation visible to "
90 "search, if `wait_for` then wait for a refresh to make this operation visible to search, if "
91 "`false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`",
92 },
93 "routing": <DataProviderOptionInfo>{
94 "type": AbstractDataProviderTypeMap."string",
95 "desc": "Custom value used to route operations to a specific shard",
96 },
97 "timeout": <DataProviderOptionInfo>{
98 "type": AbstractDataProviderTypeMap."string",
99 "desc": "Period to wait for a response (ex: `1m`). If no response is received before the "
100 "timeout expires, the request fails and returns an error",
101 },
102 "version": <DataProviderOptionInfo>{
103 "type": AbstractDataProviderTypeMap."int",
104 "desc": "Explicit version number for concurrency control. The specified version must match the "
105 "current version of the document for the request to succeed",
106 },
107 "version_type": <DataProviderOptionInfo>{
108 "type": AbstractDataProviderTypeMap."string",
109 "desc": "Specific version type: `external`, `external_gte`",
110 },
111 "wait_for_active_shards": <DataProviderOptionInfo>{
112 "type": AbstractDataProviderTypeMap."string",
113 "desc": "The number of shard copies that must be active before proceeding with the operation. Set to "
114 "`all` or any positive integer up to the total number of shards in the index (number_of_replicas+1)",
115 },
116 "require_alias": <DataProviderOptionInfo>{
118 "desc": "If `true`, the destination must be an index alias",
119 },
120 },
121 "search_options": {
122 "if_seq_no": <DataProviderOptionInfo>{
123 "type": AbstractDataProviderTypeMap."int",
124 "desc": "Only perform the operation if the document has this sequence number\n"
125 "(update only)",
126 },
127 "if_primary_term": <DataProviderOptionInfo>{
128 "type": AbstractDataProviderTypeMap."int",
129 "desc": "Only perform the operation if the document has this primary term\n"
130 "(update only)",
131 },
132 "lang": <DataProviderOptionInfo>{
133 "type": AbstractDataProviderTypeMap."string",
134 "desc": "The script language\n"
135 "(update only)",
136 },
137 "operator": <DataProviderOptionInfo>{
138 "type": AbstractDataProviderTypeMap."string",
139 "desc": "Boolean logic used to interpret text in the query value. Valid values are:\n"
140 "- `or` (Default): For example, a query value of `capital of Hungary` is interpreted as "
141 "`capital OR of OR Hungary`\n"
142 "- `and`: For example, a query value of `capital of Hungary` is interpreted as "
143 "`capital AND of AND Hungary`\n"
144 "(search only)",
145 "allowed_values": (
146 <AllowedValueInfo>{
147 "value": "or",
148 "desc": "Or logic - any terms match (default)",
149 },
150 <AllowedValueInfo>{
151 "value": "and",
152 "desc": "And logic - all terms must match",
153 }
154 ),
155 },
156 "require_alias": <DataProviderOptionInfo>{
158 "desc": "If `true`, the destination must be an index alias\n"
159 "(update only)",
160 },
161 "refresh": <DataProviderOptionInfo>{
162 "type": AbstractDataProviderTypeMap."string",
163 "desc": "If `true`, Elasticsearch refreshes the affected shards to make this operation visible to "
164 "search, if `wait_for` then wait for a refresh to make this operation visible to search, if "
165 "`false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`\n"
166 "(update only)",
167 },
168 "retry_on_conflict": <DataProviderOptionInfo>{
169 "type": AbstractDataProviderTypeMap."int",
170 "desc": "Specify how many times should the operation be retried when a conflict occurs\n"
171 "(update only)",
172 },
173 "routing": <DataProviderOptionInfo>{
174 "type": AbstractDataProviderTypeMap."string",
175 "desc": "Custom value used to route operations to a specific shard\n"
176 "(update only)",
177 },
178 "_source": <DataProviderOptionInfo>{
179 "type": AbstractDataProviderTypeMap."string",
180 "desc": "Set to `false` to disable source retrieval (default: `true`). You can also specify a "
181 "comma-separated list of the fields you want to retrieve\n"
182 "(update only)",
183 },
184 "_source_excludes": <DataProviderOptionInfo>{
185 "type": AbstractDataProviderTypeMap."string",
186 "desc": "Specify the source fields you want to exclude\n"
187 "(update only)",
188 },
189 "_source_includes": <DataProviderOptionInfo>{
190 "type": AbstractDataProviderTypeMap."string",
191 "desc": "Specify the source fields you want to exclude\n"
192 "(update only)",
193 },
194 "timeout": <DataProviderOptionInfo>{
195 "type": AbstractDataProviderTypeMap."string",
196 "desc": "Period to wait for a response (ex: `1m` = 1 minute). If no response is received before "
197 "the timeout expires, the request fails and returns an error",
198 },
199 "version": <DataProviderOptionInfo>{
200 "type": AbstractDataProviderTypeMap."string",
201 "desc": "",
202 },
203 "wait_for_active_shards": <DataProviderOptionInfo>{
204 "type": AbstractDataProviderTypeMap."string",
205 "desc": "The number of shard copies that must be active before proceeding with the operation. "
206 "Set to `all` or any positive integer up to the total number of shards in the index "
207 "(number_of_replicas+1)\n"
208 "(update only)",
209 },
210 },
211 };
212
214 const ProviderSummaryInfo = cast<hash<DataProviderSummaryInfo>>(ProviderInfo{
215 AbstractDataProvider::DataProviderSummaryInfoKeys
216 });
217
219 const TypeMap = {
220 "binary": AbstractDataProviderTypeMap."base64binary",
221
222 "boolean": AbstractDataProviderTypeMap."boolean",
223
224 "keyword": AbstractDataProviderTypeMap."string",
225 "constant_keyword": AbstractDataProviderTypeMap."string",
226 "wildcard": AbstractDataProviderTypeMap."string",
227
228 "ip": AbstractDataProviderTypeMap."string",
229 "version": AbstractDataProviderTypeMap."string",
230 "mumur3": AbstractDataProviderTypeMap."string",
231
232 "text": AbstractDataProviderTypeMap."string",
233 "match_only_text": AbstractDataProviderTypeMap."string",
234
235 "byte": AbstractDataProviderTypeMap."int",
236 "short": AbstractDataProviderTypeMap."int",
237 "integer": AbstractDataProviderTypeMap."int",
238 "long": AbstractDataProviderTypeMap."int",
239
240 "unsigned_long": AbstractDataProviderTypeMap."number",
241
242 "date": AbstractDataProviderTypeMap."date",
243 // NOTE: lossy conversion here; Qore only supports microsecond resolution
244 "date_nanos": AbstractDataProviderTypeMap."date",
245
246 "double": AbstractDataProviderTypeMap."float",
247 "float": AbstractDataProviderTypeMap."float",
248 "half_float": AbstractDataProviderTypeMap."float",
249 "scaled_float": AbstractDataProviderTypeMap."float",
250
251 "object": AbstractDataProviderTypeMap."hash",
252 "flattened": AbstractDataProviderTypeMap."hash",
253
254 "nested": AbstractDataProviderTypeMap."list",
255 };
256
258 const SearchQueryOptions = ("timeout",);
259
260protected:
262 hash<string, AbstractDataField> record_type = {
263 "_id": new QoreDataField("_id", "the document ID", AbstractDataProviderTypeMap."softstring"),
264 "_score": new QoreDataField("_score", "the score for the match (read-only)",
265 AbstractDataProviderTypeMap."float"),
266 };
267
268public:
269
271 constructor(RestClient::RestClient rest, string name, hash<auto> index) ;
272
273
275 string getName();
276
277
279 *string getDesc();
280
281
283
288protected:
289 DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
290public:
291
292
294
303protected:
304 int updateRecordsImpl(hash<auto> set, *hash<auto> where_cond, *hash<auto> search_options);
305public:
306
307
317protected:
318 int deleteRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
319public:
320
321
323
331protected:
332 *hash<auto> createRecordImpl(hash<auto> rec, *hash<auto> create_options);
333public:
334
335
337 hash<DataProvider::DataProviderInfo> getStaticInfoImpl();
338
339
342
343
345 static string getQueryOptions(string uri, hash<auto> search_options, list<string> query_args);
346
348protected:
349 string getDocUriPath(string uri_str, *hash<auto> where_cond, string action, *hash<auto> search_options, *list<string> query_args);
350public:
351
352
354protected:
356public:
357
358
359protected:
360 *hash<string, DataProvider::AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
361public:
362
363};
364};
The AWS REST client base data provider class.
Definition: ElasticSearchDataProviderBase.qc.dox.h:28
const ConstructorOptions
Constructor options.
Definition: ElasticSearchDataProvider.qc.dox.h:61
This class exposes ElasticSearch indices as record-based data providers.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:38
const ProviderSummaryInfo
Provider summary info.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:214
const ProviderInfo
Provider info.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:48
static string getQueryOptions(string uri, hash< auto > search_options, list< string > query_args)
Returns a URI path with query options.
DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
int deleteRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
DataProvider::AbstractDataProviderType getTypeForProperty(string name, hash< auto > prop)
Returns a data type for a property.
const SearchQueryOptions
Search query options.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:258
constructor(RestClient::RestClient rest, string name, hash< auto > index)
Creates the object from a REST connection.
int updateRecordsImpl(hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
Updates a single document in the index.
hash< DataProvider::DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
hash< auto > index
Index hash.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:45
hash< string, AbstractDataField > record_type
The record type for the object.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:262
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Writes the given record to the data provider.
string name
Current index name.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:42
*string getDesc()
Returns the data provider description.
string getDocUriPath(string uri_str, *hash< auto > where_cond, string action, *hash< auto > search_options, *list< string > query_args)
Makes sure that the where_cond is only the _id field.
const TypeMap
ElasticSearch property types to data types.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:219
Qore ElasticSearchDataProvider module definition.
Definition: ElasticSearchAcknowledgedDataType.qc.dox.h:26
const SoftBoolDataProviderStringType
Boolean data provider string type for query parameters.
Definition: ElasticSearchDataProvider.qc.dox.h:138