Qore ElasticSearchDataProvider Module Reference 1.0
Loading...
Searching...
No Matches
ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider Class Reference

This class exposes ElasticSearch indices as record-based data providers. More...

#include <ElasticSearchIndexTableDataProvider.qc.dox.h>

Inheritance diagram for ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider:
[legend]

Public Member Functions

 constructor (RestClient::RestClient rest, string name, hash< auto > index)
 Creates the object from a REST connection.
 
*string getDesc ()
 Returns the data provider description.
 
string getName ()
 Returns the data provider name.
 
hash< DataProvider::DataProviderInfogetStaticInfoImpl ()
 Returns data provider static info.
 
DataProvider::AbstractDataProviderType getTypeForProperty (string name, hash< auto > prop)
 Returns a data type for a property.
 
- Public Member Functions inherited from ElasticSearchDataProvider::ElasticSearchDataProviderBase
 constructor ()
 Creates the object.
 
 constructor (RestClient rest)
 Creates the object from a REST connection.
 
 setLogger (*LoggerInterface logger)
 Accepts a LoggerInterface object for logging (or clears it)
 

Static Public Member Functions

static string getQueryOptions (string uri, hash< auto > search_options, list< string > query_args)
 Returns a URI path with query options.
 

Public Attributes

hash< auto > index
 Index hash.
 
string name
 Current index name.
 
const ProviderInfo
 Provider info.
 
const ProviderSummaryInfo
 Provider summary info.
 
const SearchQueryOptions = ("timeout",)
 Search query options.
 
const TypeMap
 ElasticSearch property types to data types.
 

Protected Member Functions

*hash< auto > createRecordImpl (hash< auto > rec, *hash< auto > create_options)
 Writes the given record to the data provider.
 
int deleteRecordsImpl (*hash< auto > where_cond, *hash< auto > search_options)
 
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.
 
 getRecordInfoIntern ()
 Retrieves the record type.
 
DataProvider::AbstractDataProviderRecordIterator searchRecordsImpl (*hash< auto > where_cond, *hash< auto > search_options)
 Returns an iterator for zero or more records matching the search options.
 
int updateRecordsImpl (hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
 Updates a single document in the index.
 

Protected Attributes

hash< string, AbstractDataField > record_type
 The record type for the object.
 

Detailed Description

This class exposes ElasticSearch indices as record-based data providers.

The record type is made up of the document attributes plus the following read-only fields:

  • _id: the document ID which functions as the data provider record ID
  • _score: the score returned from searches

Note that "where hashes" for updates and deletes accept a single field, _id, to identify the single document (data provider record) to be updated or deleted.

Searches are performed with match logic; for more flexible searching, use the index search API data provider found at index/search

Member Function Documentation

◆ createRecordImpl()

*hash< auto > ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider::createRecordImpl ( hash< auto >  rec,
*hash< auto >  create_options 
)
protected

Writes the given record to the data provider.

Parameters
reca hash representing a single input record
create_optionsthe create options (see CreateOptions) after processing by validateCreateOptions()
Returns
the data written to the data provider plus any output (returning) variables
Note
this API will commit the row to the database unless the datasource was already in a transaction before this call

◆ deleteRecordsImpl()

int ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider::deleteRecordsImpl ( *hash< auto >  where_cond,
*hash< auto >  search_options 
)
protected
Parameters
where_conda hash for identifying the record(s) to be deleted; can only contain the "_id" field
search_optionsthe search options (see SearchOptions) after processing by validateSearchOptions(); ignored for this API call
Returns
the number of records deleted
Exceptions
INVALID-OPERATIONthe data provider does not support record updating

◆ searchRecordsImpl()

DataProvider::AbstractDataProviderRecordIterator ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider::searchRecordsImpl ( *hash< auto >  where_cond,
*hash< auto >  search_options 
)
protected

Returns an iterator for zero or more records matching the search options.

Parameters
where_condthe search criteria
search_optionsthe search options after processing by validateSearchOptions()
See also
requestSearchRecordsImpl()

◆ updateRecordsImpl()

int ElasticSearchDataProvider::ElasticSearchIndexTableDataProvider::updateRecordsImpl ( hash< auto >  set,
*hash< auto >  where_cond,
*hash< auto >  search_options 
)
protected

Updates a single document in the index.

Parameters
setthe hash of field data to set
where_conda hash for identifying the record(s) to be updated
search_optionsthe search options (see SearchOptions) after processing by validateSearchOptions()
Returns
the number of records updated
Note
this API will commit the row to the database unless the datasource was already in a transaction before this call