52 "desc":
"ElasticSearch index table data provider; provdes table-like access to an ElasticSearch index; "
53 "fields returned in searches are document properties, plus the special `_id` (document ID) and "
54 "`_score` (query match score) values, which are read-only.\n\n"
55 "Updating and deleting can be performed, but the 'where clause hash` must contain only a single "
56 "`_id` key to identify the document by its ID.\n\n"
57 "Searches are performed with `match`; for more flexible searching, use the index search API data "
58 "provider, `index/search`",
59 "type":
"ElasticSearchIndexTableDataProvider",
62 "supports_read":
True,
63 "supports_native_search":
True,
64 "supports_update":
True,
65 "supports_delete":
True,
66 "supports_create":
True,
68 "if_seq_no": <DataProviderOptionInfo>{
69 "type": AbstractDataProviderTypeMap.
"int",
70 "desc":
"Only perform the operation if the document has this sequence number",
72 "if_primary_term": <DataProviderOptionInfo>{
73 "type": AbstractDataProviderTypeMap.
"int",
74 "desc":
"Only perform the operation if the document has this primary term",
76 "op_type": <DataProviderOptionInfo>{
77 "type": AbstractDataProviderTypeMap.
"string",
78 "desc":
"Set to create to only index the document if it does not already exist (put if absent). If a "
79 "document with the specified `_id` already exists, the indexing operation will fail. Same as "
80 "using the `<index>/_create` endpoint. Valid values: `index`, `create`. If document id is "
81 "specified, it defaults to `index`. Otherwise, it defaults to `create`",
83 "pipeline": <DataProviderOptionInfo>{
84 "type": AbstractDataProviderTypeMap.
"string",
85 "desc":
"ID of the pipeline to use to preprocess incoming documents. If the index has a default "
86 "ingest pipeline specified, then setting the value to _none disables the default ingest pipeline "
87 "for this request. If a final pipeline is configured it will always run, regardless of the value "
90 "refresh": <DataProviderOptionInfo>{
91 "type": AbstractDataProviderTypeMap.
"string",
92 "desc":
"If `true`, Elasticsearch refreshes the affected shards to make this operation visible to "
93 "search, if `wait_for` then wait for a refresh to make this operation visible to search, if "
94 "`false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`",
96 "routing": <DataProviderOptionInfo>{
97 "type": AbstractDataProviderTypeMap.
"string",
98 "desc":
"Custom value used to route operations to a specific shard",
100 "timeout": <DataProviderOptionInfo>{
101 "type": AbstractDataProviderTypeMap.
"string",
102 "desc":
"Period to wait for a response (ex: `1m`). If no response is received before the "
103 "timeout expires, the request fails and returns an error",
105 "version": <DataProviderOptionInfo>{
106 "type": AbstractDataProviderTypeMap.
"int",
107 "desc":
"Explicit version number for concurrency control. The specified version must match the "
108 "current version of the document for the request to succeed",
110 "version_type": <DataProviderOptionInfo>{
111 "type": AbstractDataProviderTypeMap.
"string",
112 "desc":
"Specific version type: `external`, `external_gte`",
114 "wait_for_active_shards": <DataProviderOptionInfo>{
115 "type": AbstractDataProviderTypeMap.
"string",
116 "desc":
"The number of shard copies that must be active before proceeding with the operation. Set to "
117 "`all` or any positive integer up to the total number of shards in the index (number_of_replicas+1)",
119 "require_alias": <DataProviderOptionInfo>{
121 "desc":
"If `true`, the destination must be an index alias",
125 "if_seq_no": <DataProviderOptionInfo>{
126 "type": AbstractDataProviderTypeMap.
"int",
127 "desc":
"Only perform the operation if the document has this sequence number\n"
130 "if_primary_term": <DataProviderOptionInfo>{
131 "type": AbstractDataProviderTypeMap.
"int",
132 "desc":
"Only perform the operation if the document has this primary term\n"
135 "lang": <DataProviderOptionInfo>{
136 "type": AbstractDataProviderTypeMap.
"string",
137 "desc":
"The script language\n"
140 "operator": <DataProviderOptionInfo>{
141 "type": AbstractDataProviderTypeMap.
"string",
142 "desc":
"Boolean logic used to interpret text in the query value. Valid values are:\n"
143 "- `or` (Default): For example, a query value of `capital of Hungary` is interpreted as "
144 "`capital OR of OR Hungary`\n"
145 "- `and`: For example, a query value of `capital of Hungary` is interpreted as "
146 "`capital AND of AND Hungary`\n"
151 "desc":
"Or logic - any terms match (default)",
155 "desc":
"And logic - all terms must match",
159 "require_alias": <DataProviderOptionInfo>{
161 "desc":
"If `true`, the destination must be an index alias\n"
164 "refresh": <DataProviderOptionInfo>{
165 "type": AbstractDataProviderTypeMap.
"string",
166 "desc":
"If `true`, Elasticsearch refreshes the affected shards to make this operation visible to "
167 "search, if `wait_for` then wait for a refresh to make this operation visible to search, if "
168 "`false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`\n"
171 "retry_on_conflict": <DataProviderOptionInfo>{
172 "type": AbstractDataProviderTypeMap.
"int",
173 "desc":
"Specify how many times should the operation be retried when a conflict occurs\n"
176 "routing": <DataProviderOptionInfo>{
177 "type": AbstractDataProviderTypeMap.
"string",
178 "desc":
"Custom value used to route operations to a specific shard\n"
181 "_source": <DataProviderOptionInfo>{
182 "type": AbstractDataProviderTypeMap.
"string",
183 "desc":
"Set to `false` to disable source retrieval (default: `true`). You can also specify a "
184 "comma-separated list of the fields you want to retrieve\n"
187 "_source_excludes": <DataProviderOptionInfo>{
188 "type": AbstractDataProviderTypeMap.
"string",
189 "desc":
"Specify the source fields you want to exclude\n"
192 "_source_includes": <DataProviderOptionInfo>{
193 "type": AbstractDataProviderTypeMap.
"string",
194 "desc":
"Specify the source fields you want to exclude\n"
197 "timeout": <DataProviderOptionInfo>{
198 "type": AbstractDataProviderTypeMap.
"string",
199 "desc":
"Period to wait for a response (ex: `1m` = 1 minute). If no response is received before "
200 "the timeout expires, the request fails and returns an error",
202 "version": <DataProviderOptionInfo>{
203 "type": AbstractDataProviderTypeMap.
"string",
206 "wait_for_active_shards": <DataProviderOptionInfo>{
207 "type": AbstractDataProviderTypeMap.
"string",
208 "desc":
"The number of shard copies that must be active before proceeding with the operation. "
209 "Set to `all` or any positive integer up to the total number of shards in the index "
210 "(number_of_replicas+1)\n"
218 AbstractDataProvider::DataProviderSummaryInfoKeys
223 "binary": AbstractDataProviderTypeMap.
"base64binary",
225 "boolean": AbstractDataProviderTypeMap.
"boolean",
227 "keyword": AbstractDataProviderTypeMap.
"string",
228 "constant_keyword": AbstractDataProviderTypeMap.
"string",
229 "wildcard": AbstractDataProviderTypeMap.
"string",
231 "ip": AbstractDataProviderTypeMap.
"string",
232 "version": AbstractDataProviderTypeMap.
"string",
233 "mumur3": AbstractDataProviderTypeMap.
"string",
235 "text": AbstractDataProviderTypeMap.
"string",
236 "match_only_text": AbstractDataProviderTypeMap.
"string",
238 "byte": AbstractDataProviderTypeMap.
"int",
239 "short": AbstractDataProviderTypeMap.
"int",
240 "integer": AbstractDataProviderTypeMap.
"int",
241 "long": AbstractDataProviderTypeMap.
"int",
243 "unsigned_long": AbstractDataProviderTypeMap.
"number",
245 "date": AbstractDataProviderTypeMap.
"date",
247 "date_nanos": AbstractDataProviderTypeMap.
"date",
249 "double": AbstractDataProviderTypeMap.
"float",
250 "float": AbstractDataProviderTypeMap.
"float",
251 "half_float": AbstractDataProviderTypeMap.
"float",
252 "scaled_float": AbstractDataProviderTypeMap.
"float",
254 "object": AbstractDataProviderTypeMap.
"hash",
255 "flattened": AbstractDataProviderTypeMap.
"hash",
257 "nested": AbstractDataProviderTypeMap.
"list",
266 "_id":
new QoreDataField(
"_id",
"the document ID", AbstractDataProviderTypeMap.
"softstring"),
267 "_score":
new QoreDataField(
"_score",
"the score for the match (read-only)",
268 AbstractDataProviderTypeMap.
"float"),
292 *hash<auto> search_options) {
348 static string getQueryOptions(
string uri, hash<auto> search_options, list<string> query_args);
351 private string getDocUriPath(
string uri_str, *hash<auto> where_cond,
string action, *hash<auto> search_options,
352 *list<string> query_args) {
353 if (!where_cond._id.val());
355 if (where_cond._id.typeCode() !=
NT_STRING);
357 if (where_cond.size() > 1);
359 string rv =
sprintf(
"%s/%s/%s",
name, uri_str, where_cond._id);
360 return search_options && query_args ?
getQueryOptions(rv, search_options, query_args) : rv;
370 *hash<string, DataProvider::AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
const ConstructorOptions
Constructor options.
Definition: ElasticSearchDataProvider.qc.dox.h:64
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:217
const ProviderInfo
Provider info.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:51
static string getQueryOptions(string uri, hash< auto > search_options, list< string > query_args)
Returns a URI path with query 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.
private 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.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:351
const SearchQueryOptions
Search query options.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:261
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.
string getName()
Returns the data provider name.
hash< auto > index
Index hash.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:48
hash< string, AbstractDataField > record_type
The record type for the object.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:265
RestClient::RestClient rest
REST client connection.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:42
private DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:291
*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:45
getRecordInfoIntern()
Retrieves the record type.
*string getDesc()
Returns the data provider description.
const TypeMap
ElasticSearch property types to data types.
Definition: ElasticSearchIndexTableDataProvider.qc.dox.h:222
Defines the record iterator class for Table-based iterators.
Definition: ElasticSearchRecordIterator.qc.dox.h:28
string sprintf(string fmt,...)
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:137