| Qore ElasticSearchDataProvider Module Reference 1.1

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
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::DataProviderInfo > | getStaticInfoImpl ()
| 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

  rec | a hash representing a single input record
  create_options | the 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_cond | a hash for identifying the record(s) to be deleted; can only contain the `"_id"` field
  search_options | the search options (see SearchOptions) after processing by validateSearchOptions(); ignored for this API call

Returns
  the number of records deleted

Exceptions

  INVALID-OPERATION | the 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_cond | the search criteria
  search_options | the 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

  set | the hash of field data to set
  where_cond | a hash for identifying the record(s) to be updated
  search_options | the 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