The CData Sync App provides a straightforward way to continuously pipeline your Elasticsearch data to any database, data lake, or data warehouse, making it easily available for Analytics, Reporting, AI, and Machine Learning.
The Elasticsearch connector can be used from the CData Sync application to pull data from Elasticsearch and move it to any of the supported destinations.
Create a connection to Elasticsearch by navigating to the Connections page in the Sync App application and selecting the corresponding icon in the Add Connections panel. If the Elasticsearch icon is not available, click the Add More icon to download and install the Elasticsearch connector from the CData site.
Required properties are listed under the Settings tab. The Advanced tab lists connection properties that are not typically required.
Set the following to connect to data:
Server=https://01.02.03.04
OR
Server=https://01.01.01.01:1234,https://02.02.02.02:5678
The Sync App uses X-Pack Security for authentication and TLS/SSL encryption. You can prefix the server value with "https://" to connect using TLS/SSL.
Set the following to connect to data:
The Sync App uses X-Pack Security for authentication and TLS/SSL encryption.
Note: Requests are signed using AWS Signature Version 4.
To obtain the credentials for an IAM user, follow the steps below:
To obtain the credentials for your AWS root account, follow the steps below:
Set the AuthScheme to Basic, and set User and Password properties and/or use PKI (public key infrastructure) to authenticate. Once the Sync App is connected, X-Pack performs user authentication and grants role permissions based on the realms you have configured.
To use PKI, set the SSLClientCert, SSLClientCertType, SSLClientCertSubject, and SSLClientCertPassword properties.
Note: TLS/SSL and client authentication must be enabled on X-Pack to use PKI.
To enable TLS/SSL in the Sync App, prefix the Server value with 'https://'.
To authenticate using account root credentials, set the following:
Note: Use of this authentication scheme is discouraged by Amazon for anything but simple tests. The account root credentials have the full permissions of the user, making this the least secure authentication method.
To authenticate using temporary credentials, specify the following:
The Sync App can now request resources using the same permissions provided by long-term credentials (such as IAM user credentials) for the lifespan of the temporary credentials.
If you are also using an IAM role to authenticate, you must additionally specify the following:
In many situations it may be preferable to use an IAM role for authentication instead of the direct security credentials of an AWS root user.
To authenticate as an AWS role, set the following:
Note: Roles may not be used when specifying the AWSAccessKey and AWSSecretKey of an AWS root user.
Please see Using Kerberos for details on how to authenticate with Kerberos.
To authenticate using APIKey set the following:
This section shows how to use the Sync App to authenticate using Kerberos.
To authenticate to Elasticsearch using Kerberos, set the following properties:
You can use one of the following options to retrieve the required Kerberos ticket.
This option enables you to use the MIT Kerberos Ticket Manager or kinit command to get tickets. Note that you do not need to set the User or Password connection properties with this option.
As an alternative to setting the KRB5CCNAME environment variable, you can directly set the file path using the KerberosTicketCache property. When set, the Sync App uses the specified cache file to obtain the Kerberos ticket to connect to Elasticsearch.
If the KRB5CCNAME environment variable has not been set, you can retrieve a Kerberos ticket using a Keytab File. To do so, set the User property to the desired username and set the KerberosKeytabFile property to a file path pointing to the keytab file associated with the user.
If both the KRB5CCNAME environment variable and the KerberosKeytabFile property have not been set, you can retrieve a ticket using a user and password combination. To do this, set the User and Password properties to the user/password combination that you use to authenticate with Elasticsearch.
More complex Kerberos environments may require cross-realm authentication where multiple realms and KDC servers are used (e.g., where one realm/KDC is used for user authentication and another realm/KDC is used for obtaining the service ticket).
In such an environment, set the KerberosRealm and KerberosKDC properties to the values required for user authentication. Also set the KerberosServiceRealm and KerberosServiceKDC properties to the values required to obtain the service ticket.
You can use the following properties to gain greater control over Elasticsearch API features and the strategies the Sync App uses to surface them:
Multiple indices can be queried by executing a query using one of the following formats:
Query all indices via the _all view: SELECT * FROM [_all]
Query a list of indices: SELECT * FROM [index1,index2,index3]
Query indices matching a wildcard pattern: SELECT * FROM [index*]
Note, index lists can contain wildcards and indices can be excluded by prefixing an index with '-'. For example: SELECT * FROM [index*,-index3]
If you are using the Scroll API, set ScrollDuration instead.
Elasticsearch is a document-oriented database that provides high performance searching, flexibility, and scalability. These features are not necessarily incompatible with a standards-compliant query language like SQL-92. In this section we will show various schemes that the Sync App offers to bridge the gap with relational SQL and an Elasticsearch database.
The Sync App models Elasticsearch objects into relational tables and translates SQL queries into Elasticsearch queries to get the requested data. See Schema Mapping for more details on how Elasticsearch objects are mapped to tables to generate schemas. See Query Mapping for more details on how various Elasticsearch operations are represented as SQL.
The Automatic Schema Discovery scheme automatically finds the data types by retrieving the mapping for the Elasticsearch type. You can use RowScanDepth, FlattenArrays, and FlattenObjects to control the relational representation of the collections in Elasticsearch.
The CData Sync App models the Elasticsearch REST APIs as relational tables and stored procedures that can be accessed with standard SQL. This enables access from standards-based tools.
The table definitions are dynamically retrieved. When you connect, the Sync App connects to Elasticsearch and retrieves the schemas, list of tables, and the metadata for the tables by querying the Elasticsearch REST server. Any changes to the remote data are immediately reflected in your queries.
The following table maps Elasticsearch concepts to relational ones:
Elasticsearch Versions 6 and Above:
Elasticsearch Concept | SQL Concept |
Index | Table |
Alias | View |
Document | Row (each document is a row and the document's JSON structure is represented as columns) |
Field | Column |
Note: Starting in Elasticsearch 6, indices are limited to a single type. Therefore the type is no longer treated as a table, since an index and type have a one-to-one relation. Types are hidden and used internally where necessary to issue the proper request to Elasticsearch.
Elasticsearch Versions Prior to Version 6:
Elasticsearch Concept | SQL Concept |
Index | Schema |
Type | Table |
Alias | View |
Document | Row (each document is a row and the document's JSON structure is represented as columns) |
Field | Column |
Elasticsearch contains the ability to establish parent-child relationships. This relationship maps closely to SQL JOIN functionality. The Sync App models these parent-child relationships in a way to enable the ability to perform JOIN queries.
Elasticsearch Versions 6 and Above:
In version 6 and above of Elasticsearch, relationships are established by using the join datatype. Included in this functionality is the ability to define multiple children for a single parent and to create multiple levels of relations.
The Sync App supports all of these relationships and will generate a separate table for each relation in Elasticsearch. The table name will be in the form: [index]_[relation].
All child tables will have an additional column containing the parent table id. The column name will be in the form: _[parent_table]_id. This column is a foreign key to the _id column of the parent table and can be used to perform SQL JOIN queries.
When querying these tables individually, filtering logic is pushed to the server to improve performance by only returning the data relevant to the table selected.
Elasticsearch Versions Prior to Version 6:
In versions prior to 6, a relationship is established between two types via a _parent field. This creates a single parent-child relationship.
The tables identified in this parent-child relationship do not change (they are still based on the Elasticsearch type). However the child table will have an additional column containing the parent id. The column name will be in the form: _[parent_table]_id. This column is a foreign key to the _id column of the parent table and can be used to perform SQL JOIN queries.
Below is the raw data used throughout this chapter. Following is the mapping for the "insured" table (index):
{ "insured": { "mappings": { "properties": { "name": { "type":"string" }, "address": { "street": { "type":"string" }, "city": { "type":"string" }, "state": { "type":"string" } }, "insured_ages": { "type": "integer" }, "vehicles": { "type": "nested", "properties": { "year": { "type":"integer" }, "make": { "type":"string" }, "model": { "type":"string" }, "body_style" { "type": "string" } } } } } } }
The following is the sample data set for the "insured" table (index):
{ "hits": { "total": 2, "max_score": 1, "hits": [ { "_index": "insured", "_type": "_doc", "_id": "1", "_score": 1, "_source": { "name": "John Smith", "address": { "street": "Main Street", "city": "Chapel Hill", "state": "NC" }, "insured_ages": [ 17, 43, 45 ], "vehicles": [ { "year": 2015, "make": "Dodge", "model": "RAM 1500", "body_style": "TK" }, { "year": 2015, "make": "Suzuki", "model": "V-Strom 650 XT", "body_style": "MC" }, { "year": 1992, "make": "Harley Davidson", "model": "FXR", "body_style": "MC" } ] } }, { "_index": "insured", "_type": "_doc", "_id": "2", "_score": 1, "_source": { "name": "Joseph Newman", "address": { "street": "Oak Street", "city": "Raleigh", "state": "NC" }, "insured_ages": [ 23, 25 ], "vehicles": [ { "year": 2010, "make": "Honda", "model": "Accord", "body_style": "SD" }, { "year": 2008, "make": "Honda", "model": "Civic", "body_style": "CP" } ] } } ] } }
The Sync App automatically infers a relational schema by retrieving the mapping of the Elasticsearch type. The columns and data types are generated from the retrieved mapping.
Any field within Elasticsearch can be an array of values, but this is not explicitly defined within the mapping. To account for this, the Sync App will query the data to detect if any fields contain arrays. The number of Elasticsearch documents retrieved during this array scanning is based on the RowScanDepth property.
Elasticsearch nested types are special types that denote an array of objects and thus will always be treated as such when generating the metadata.
The columns identified during the discovery process depend on the FlattenArrays and FlattenObjects properties.
To provide an example of how these options work, consider the following mapping (where 'insured' is the name of the table):
{ "insured": { "properties": { "name": { "type":"string" }, "address": { "street": { "type":"string" }, "city": { "type":"string" }, "state": { "type":"string" } }, "insured_ages": { "type": "integer" }, "vehicles": { "type": "nested", "properties": { "year": { "type":"integer" }, "make": { "type":"string" }, "model": { "type":"string" }, "body_style" { "type": "string" } } } } } }
Also consider the following example data for the above mapping:
{ "_source": { "name": "John Smith", "address": { "street": "Main Street", "city": "Chapel Hill", "state": "NC" }, "insured_ages": [ 17, 43, 45 ], "vehicles": [ { "year": 2015, "make": "Dodge", "model": "RAM 1500", "body_style": "TK" }, { "year": 2015, "make": "Suzuki", "model": "V-Strom 650 XT", "body_style": "MC" }, { "year": 2012, "make": "Honda", "model": "Accord", "body_style": "4D" } ] } }
If FlattenObjects is set, all nested objects will be flattened into a series of columns. The above example will be represented by the following columns:
Column Name | Data Type | Example Value |
name | String | John Smith |
address.street | String | Main Street |
address.city | String | Chapel Hill |
address.state | String | NC |
insured_ages | String | [ 17, 43, 45 ] |
vehicles | String | [ { "year": "2015", "make": "Dodge", ... }, { "year": "2015", "make": "Suzuki", ... }, { "year": "2012", "make": "Honda", ... } ] |
If FlattenObjects is not set, then the address.street, address.city, and address.state columns will not be broken apart. The address column of type string will instead represent the entire object.
Its value would be the following:
{street: "Main Street", city: "Chapel Hill", state: "NC"}See JSON Functions for more details on working with JSON aggregates.
The FlattenArrays property can be used to flatten array values into columns of their own. This is only recommended for arrays that are expected to be short. It is best to leave unbounded arrays as they are and piece out the data for them as needed using JSON Functions.
Note: Only the top-most array will be flattened. Any subarrays will be represented as the entire array.
The FlattenArrays property can be set to 3 to represent the arrays in the example above as follows (this example is with FlattenObjects not set):
Column Name | Data Type | Example Value |
insured_ages | String | [ 17, 43, 45 ] |
insured_ages.0 | Integer | 17 |
insured_ages.1 | Integer | 43 |
insured_ages.2 | Integer | 45 |
vehicles | String | [ { "year": "2015", "make": "Dodge", ... }, { "year": "2015", "make": "Suzuki", ... }, { "year": "2012", "make": "Honda", ... } ] |
vehicles.0 | String | { "year": "2015", "make": "Dodge", "model": "RAM 1500", "body_style": "TK" } |
vehicles.1 | String | { "year": "2015", "make": "Suzuki", "model": "V-Strom 650 XT", "body_style": "MC" } |
vehicles.2 | String | { "year": "2012", "make": "Honda", "model": "Accord", "body_style": "4D" } |
If FlattenObjects is set along with FlattenArrays (set to 1 for brevity), the vehicles field will be represented as follows:
Column Name | Data Type | Example Value |
vehicles | String | [ { "year": "2015", "make": "Dodge", ... }, { "year": "2015", "make": "Suzuki", ... }, { "year": "2012", "make": "Honda", ... } ] |
vehicles.0.year | String | 2015 |
vehicles.0.make | String | Dodge |
vehicles.0.model | String | RAM 1500 |
vehicles.0.body_style | String | TK |
The Sync App offers three basic configurations to model documents as tables, described in the following sections. The Sync App will parse the Elasticsearch document and identify the nested documents.
For users who need access to the entirety of their nested Elasticsearch data, flattening the data into a single table is the best option. The Sync App will use streaming and only parses the Elasticsearch data once per query in this mode.
With DataModel set to "FlattenedDocuments", nested documents will behave as separate tables and act in the same manner as a SQL JOIN. Any nested documents, at the same height (e.g. sibling documents), will be treated as a SQL CROSS JOIN.
Below is a sample query and the results, based on the sample document in Raw Data. This implicitly JOINs the insured document with the nested vehicles document.
The following query drills into the nested documents in each insured document.
SELECT
[_id],
[name],
[address.street] AS address_street,
[address.city.first] AS address_city,
[address.state.last] AS address_state,
[insured_ages],
[year],
[make],
[model],
[body_style],
[_insured_id],
[_vehicles_c_id]
FROM
[insured]
_id | name | address_street | address_city | address_state | insured_ages | year | make | model | body_style | _insured_id | _vehicles_c_id | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 2015 | Dodge | RAM 1500 | TK | 1 | 1 | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 2015 | Suzuki | V-Strom 650 XT | MC | 1 | 2 | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 1992 | Harley Davidson | FXR | MC | 1 | 3 | |
2 | Joseph Newman | Oak Street | Raleigh | NC | [ 23, 25 ] | 2010 | Honda | Accord | SD | 2 | 4 | |
2 | Joseph Newman | Oak Street | Raleigh | NC | [ 23, 25 ] | 2008 | Honda | Civic | CP | 2 | 5 |
Using a top-level document view of the Elasticsearch data provides ready access to top-level elements. The Sync App returns nested elements in aggregate, as single columns.
One aspect to consider is performance. You forego the time and resources to process and parse nested elements -- the Sync App parses the returned data once, using streaming to read the JSON data. Another consideration is your need to access any data stored in nested parent elements, and the ability of your tool or application to process JSON.
With DataModel set to "Document" (the default), the Sync App scans only the top-level object by default. The top-level object elements are available as columns due to the default object flattening. Nested objects are returned as aggregated JSON.
Below is a sample query and the results, based on the sample document in Raw Data. The query results in a single "insured" table.
The following query pulls the top-level object elements and the vehicles array into the results.
SELECT
[_id],
[name],
[address.street] AS address_street,
[address.city] AS address_city,
[address.state] AS address_state,
[insured_ages],
[vehicles]
FROM
[insured]
With a document view of the data, the address object is flattened into 3 columns (when FlattenObjects set to true) and the _id, name, insured_ages, and vehicles elements are returned as individual columns, resulting in a table with 7 columns.
_id | name | address_street | address_city | address_state | insured_ages | vehicles | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | [{"year":2015,"make":"Dodge","model":"RAM 1500","body_style":"TK"},{"year":2015,"make":"Suzuki","model":"V-Strom 650 XT","body_style":"MC"},{"year":1992,"make":"Harley Davidson","model":"FXR","body_style":"MC"}]
| |
2 | Joseph Newman | Oak Street | Raleigh | NC | [ 23, 25 ] | [{"year":2010,"make":"Honda","model":"Accord","body_style":"SD"},{"year":2008,"make":"Honda","model":"Civic","body_style":"CP"}]
|
The CData Sync App can be configured to create a relational model of the data, treating nested documents as individual tables containing a primary key and a foreign key that links to the parent document. This is particularly useful if you need to work with your Elasticsearch data in existing BI, reporting, and ETL tools that expect a relational data model.
With DataModel set to "Relational", any JOINs are controlled by the query. Any time you perform a JOIN query, the Elasticsearch index will be queried once for each table (nested document) included in the query.
Below is a sample query against the sample document in Raw Data, using a relational model.
The following query explicitly JOINs the insured and vehiclestables.
SELECT
[insured].[_id],
[insured].[name],
[insured].[address.street] AS address_street,
[insured].[address.city.first] AS address_city,
[insured].[address.state.last] AS address_state,
[insured].[insured_ages],
[vehicles].[year],
[vehicles].[make],
[vehicles].[model],
[vehicles].[body_style],
[vehicles].[_insured_id],
[vehicles].[_c_id]
FROM
[insured]
JOIN
[vehicles]
ON
[insured].[_id] = [vehicles].[_insured_id]
In the example query, each vehicle document is JOINed to its parent insured object to produce a table with 5 rows.
_id | name | address_street | address_city | address_state | insured_ages | year | make | model | body_style | _insured_id | _vehicles_c_id | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 2015 | Dodge | RAM 1500 | TK | 1 | 1 | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 2015 | Suzuki | V-Strom 650 XT | MC | 1 | 2 | |
1 | John Smith | Main Street | Chapel Hill | NC | [ 17, 43, 45 ] | 1992 | Harley Davidson | FXR | MC | 1 | 3 | |
2 | Joseph Newman | Oak Street | Raleigh | NC | [ 23, 25 ] | 2010 | Honda | Accord | SD | 2 | 4 | |
2 | Joseph Newman | Oak Street | Raleigh | NC | [ 23, 25 ] | 2008 | Honda | Civic | CP | 2 | 5 |
The Sync App can return JSON structures as column values. The Sync App enables you to use standard SQL functions to work with these JSON structures. The examples in this section use the following array:
[ { "grade": "A", "score": 2 }, { "grade": "A", "score": 6 }, { "grade": "A", "score": 10 }, { "grade": "A", "score": 9 }, { "grade": "B", "score": 14 } ]
SELECT Name, JSON_EXTRACT(grades,'[0].grade') AS Grade, JSON_EXTRACT(grades,'[0].score') AS Score FROM Students;
Column Name | Example Value |
Grade | A |
Score | 2 |
SELECT Name, JSON_COUNT(grades,'[x]') AS NumberOfGrades FROM Students;
Column Name | Example Value |
NumberOfGrades | 5 |
SELECT Name, JSON_SUM(score,'[x].score') AS TotalScore FROM Students;
Column Name | Example Value |
TotalScore | 41 |
SELECT Name, JSON_MIN(score,'[x].score') AS LowestScore FROM Students;
Column Name | Example Value |
LowestScore | 2 |
SELECT Name, JSON_MAX(score,'[x].score') AS HighestScore FROM Students;
Column Name | Example Value |
HighestScore | 14 |
The DOCUMENT function can be used to retrieve the entire document as a JSON string. See the following query and its result as an example:
SELECT DOCUMENT(*) FROM Employee;The query above will return the entire document as shown.
{ "_index": "megacorp", "_type": "employee", "_id": "2", "_score": 1, "_source": { "first_name": "Jane", "last_name": "Smith", "age": 32, "about": "I like to collect rock albums", "interests": [ "music" ] } }
This section describes how SQL statements are interpreted and translated into Elasticsearch queries. Examples are also provided to explain the behavior of various queries.
To demonstrate this point, an
analyzed field in Elasticsearch was created with a value of 'Bike'. After being analyzed, the value will be stored in the inverted index (using the default analyzer) as 'bike'.
A non-analyzed field, on the other hand, would not analyze the search value and thus would be stored as 'Bike'.
When performing searches, some Elasticsearch query types run the search value through an analyzer (which will make the search case insensitive) and some do not (making the search
case sensitive). Additionally, the default analyzer breaks up fields containing multiple words into separate terms. When performing searches on these fields,
Elasticsearch may return records that contain the same words but in a different order. For example, a search is performed using a value of 'blue sky' but a record with
'sky blue' is returned.
To work around these case-sensitivity and ordering issues, the CData Sync App will identify the column as analyzed or non-analyzed and will issue the appropriate Elasticsearch query based on the specified operator (such as =) and the search value.
Analyzed Columns
Analyzed columns are stored after being run through an analyzer. As a result of that, the search values specified will be run through an analyzer on the Elasticsearch server prior to the search.
This makes the searches case-insensitive (provided the analyzer used handles casing).
WHERE Clause Examples | Elasticsearch Query Type |
WHERE analyzed_column='value' | Query String Query |
WHERE analyzed_column='value with spaces' | Match Phrase Query |
Non-Analyzed Columns
Non-analyzed columns are stored without being run through an analyzer. Thus, non-analyzed columns are case sensitive and thus search values specified for these columns are case sensitive. If the search value is
a single word, the Sync App will check the filter with the original casing specified along with three common forms: uppercase, lowercase, and capitalized. If the search value
contains multiple words, the search value will be sent as-is and thus is case sensitive.
WHERE Clause Examples | Elasticsearch Query Type |
WHERE nonanalyzed_column='myValue' | Query String Query: Four cases are checked - myValue OR MYVALUE OR myvalue OR Myvalue |
WHERE nonanalyzed_column='value with spaces' | Wildcard Query |
WHERE Clause Examples | Behavior |
WHERE column IN ('value') | Treated as: column='value' |
WHERE column NOT IN ('value') | Treated as: column!='value' |
WHERE column IN ('value1', 'value2') | Treated as: column='value1' OR column='value2' |
WHERE column NOT IN ('value1', 'value2') | Treated as: column!='value1' AND column!='value2' |
WHERE Clause Examples | Behavior |
WHERE column LIKE 'value' | Treated as: column='value' |
WHERE column NOT LIKE 'value' | Treated as: column!='value' |
WHERE analyzed_column LIKE 'v_lu%' | Query String Query with wildcards |
WHERE nonanalyzed_column LIKE 'v_lu%' | Wildcard Query with wildcards |
JSON objects and arrays of objects will be treated as raw strings and all filtering will be performed by the Sync App. Therefore an equals operation must match the entire JSON aggregate to return a result, unless a CONTAINS or LIKE operation is used.
If JSON objects are flattened into individual columns (via FlattenObjects and FlattenArrays), the column for the specific JSON field will be treated as individual columns. Thus the data type will be that as contained in the Elasticsearch mapping and all filters will be pushed to the server (where applicable).
JSON primitive array aggregates will also be treated as raw strings by default and filters will be performed by the Sync App. To filter data based on whether a primitive array contains a single value, the INARRAY function can be used (e.g. INARRAY(column) = 'value'). When performing a search on array fields, Elasticsearch looks at each value individually within an array. Thus when the INARRAY function is specified in a WHERE clause, the filter will be pushed to the server which performs a search within an array.
Primitive arrays may consist of different data types, such as strings or ints. Therefore the INARRAY function supports comparison operators applicable to the data type within the Elasticsearch mapping for the field. For example, INARRAY(int_array) > 5, will return all rows of data in which the int_array contains a value greater than 5. Supported comparison operators include the use of the LIKE operator for string arrays.
View schemas persist the relational structure the Sync App infers for Elasticsearch types and queries. To provide an example of how custom schemas work, we will use the below mapping (where 'insured' is the name of the table).
{ "insured": { "properties": { "name": { "type":"string" }, "address": { "street": { "type":"string" }, "city": { "type":"string" }, "state": { "type":"string" } }, "insured_ages": { "type": "integer" }, "vehicles": { "type": "nested", "properties": { "year": { "type":"integer" }, "make": { "type":"string" }, "model": { "type":"string" }, "body_style" { "type": "string" } } } } } }
Also, consider the following example data for the above mapping:
{ "_source": { "name": "John Smith", "address": { "street": "Main Street", "city": "Chapel Hill", "state": "NC" }, "insured_ages": [ 17, 43, 45 ], "vehicles": [ { "year": 2015, "make": "Dodge", "model": "RAM 1500", "body_style": "TK" }, { "year": 2015, "make": "Suzuki", "model": "V-Strom 650 XT", "body_style": "MC" }, { "year": 2012, "make": "Honda", "model": "Accord", "body_style": "4D" } ] } }
Schemas persisted when GenerateSchemaFiles is set are placed into the folder specified by the Location property. For example, set GenerateSchemaFiles to "OnUse" and execute a SELECT query:
SELECT * FROM insured
You can then change column behavior in the resulting schema. The following schema uses the other:xPath property to define where the data for a particular column should be retrieved from. Using this model you can flatten arbitrary levels of hierarchy.
The es_index and es_type attributes specify the Elasticsearch index and type to retrieve. The es_index and es_type attributes give you the flexibility to use multiple schemas for the same type. If es_type is not specified, the filename determines the collection that is parsed.
Below is an example is an example of the column behavior markup. You can find a complete schema in Custom Schema Example.
<rsb:script xmlns:rsb="http://www.rssbus.com/ns/rsbscript/2">
<rsb:info title="StaticInsured" description="Custom Schema for the Elasticsearch insured data set.">
<!-- Column definitions -->
<attr name="_id" xs:type="string" other:xPath="_id" other:sourceField="_id" other:analyzed="true" />
<attr name="_score" xs:type="double" other:xPath="_score" other:sourceField="_score" other:analyzed="true" />
<attr name="name" xs:type="string" other:xPath="_source/name" other:sourceField="name" other:analyzed="true" />
<attr name="address.street" xs:type="string" other:xPath="_source/address/street" other:sourceField="address.street" other:analyzed="true" />
<attr name="address.city" xs:type="string" other:xPath="_source/address/city" other:sourceField="address.city" other:analyzed="true" />
<attr name="address.state" xs:type="string" other:xPath="_source/address/state" other:sourceField="address.state" other:analyzed="true" />
<attr name="insured_ages" xs:type="string" other:xPath="_source/insured_ages" other:valueFormat="aggregate" other:sourceField="insured_ages" other:analyzed="false" />
<attr name="insured_ages.0" xs:type="integer" other:xPath="_source/insured_ages[0]" other:sourceField="insured_ages" other:analyzed="false" />
<attr name="vehicles" xs:type="string" other:xPath="_source/vehicles" other:valueFormat="aggregate" other:sourceField="vehicles" other:analyzed="true" />
<attr name="vehicles.0.year" xs:type="integer" other:xPath="_source/vehicles[0]/year" other:sourceField="vehicles.year" other:analyzed="true" />
<attr name="vehicles.0.make" xs:type="string" other:xPath="_source/vehicles[0]/make" other:sourceField="vehicles.make" other:analyzed="true" />
<attr name="vehicles.0.model" xs:type="string" other:xPath="_source/vehicles[0]/model" other:sourceField="vehicles.model" other:analyzed="true" />
<attr name="vehicles.0.body_style" xs:type="string" other:xPath="_source/vehicles[0]/body_style" other:sourceField="vehicles.body_style" other:analyzed="true" />
<input name="rows@next" desc="Internal attribute used for paging through data." />
</rsb:info>
<rsb:set attr="es_index" value="auto"/>
<rsb:set attr="es_type" value="insured"/>
</rsb:script>
In this section is a complete schema. The info section enables a relational view of an Elasticsearch object. For more details, see Custom Schema Definitions. The table below only supports SELECT commands. INSERT, UPDATE, and DELETE commands are not currently supported.
Use the es_index and es_type attributes to specify the name of the Elasticsearch type and index you want to retrieve and parse. You can use the es_index and es_type attributes to define multiple schemas for the same Elasticsearch type.
If es_type is not specified, the filename determines the Elasticsearch type that is parsed.
Copy the rows@next input as-is into your schema.
The operations, such as elasticsearchadoSelect, are internal implementations and can also be copied as is.
<rsb:script xmlns:rsb="http://www.rssbus.com/ns/rsbscript/2">
<rsb:info title="StaticInsured" description="Custom Schema for the Elasticsearch insured data set.">
<!-- Column definitions -->
<attr name="_id" xs:type="string" other:xPath="_id" other:sourceField="_id" other:analyzed="true" />
<attr name="_score" xs:type="double" other:xPath="_score" other:sourceField="_score" other:analyzed="true" />
<attr name="name" xs:type="string" other:xPath="_source/name" other:sourceField="name" other:analyzed="true" />
<attr name="address.street" xs:type="string" other:xPath="_source/address/street" other:sourceField="address.street" other:analyzed="true" />
<attr name="address.city" xs:type="string" other:xPath="_source/address/city" other:sourceField="address.city" other:analyzed="true" />
<attr name="address.state" xs:type="string" other:xPath="_source/address/state" other:sourceField="address.state" other:analyzed="true" />
<attr name="insured_ages" xs:type="string" other:xPath="_source/insured_ages" other:valueFormat="aggregate" other:sourceField="insured_ages" other:analyzed="false" />
<attr name="insured_ages.0" xs:type="integer" other:xPath="_source/insured_ages[0]" other:sourceField="insured_ages" other:analyzed="false" />
<attr name="vehicles" xs:type="string" other:xPath="_source/vehicles" other:valueFormat="aggregate" other:sourceField="vehicles" other:analyzed="true" />
<attr name="vehicles.0.year" xs:type="integer" other:xPath="_source/vehicles[0]/year" other:sourceField="vehicles.year" other:analyzed="true" />
<attr name="vehicles.0.make" xs:type="string" other:xPath="_source/vehicles[0]/make" other:sourceField="vehicles.make" other:analyzed="true" />
<attr name="vehicles.0.model" xs:type="string" other:xPath="_source/vehicles[0]/model" other:sourceField="vehicles.model" other:analyzed="true" />
<attr name="vehicles.0.body_style" xs:type="string" other:xPath="_source/vehicles[0]/body_style" other:sourceField="vehicles.body_style" other:analyzed="true" />
<input name="rows@next" desc="Internal attribute used for paging through data." />
</rsb:info>
<rsb:set attr="es_index" value="auto"/>
<rsb:set attr="es_type" value="insured"/>
<rsb:script method="GET">
<rsb:call op="elasticsearchadoSelect">
<rsb:push/>
</rsb:call>
</rsb:script>
<rsb:script method="POST">
<rsb:call op="elasticsearchadoModify">
<rsb:push/>
</rsb:call>
</rsb:script>
<rsb:script method="MERGE">
<rsb:call op="elasticsearchadoModify">
<rsb:push/>
</rsb:call>
</rsb:script>
<rsb:script method="DELETE">
<rsb:call op="elasticsearchadoModify">
<rsb:push/>
</rsb:call>
</rsb:script>
</rsb:script>
This section details a selection of advanced features of the Elasticsearch Sync App.
The Sync App allows you to define virtual tables, called user defined views, whose contents are decided by a pre-configured query. These views are useful when you cannot directly control queries being issued to the drivers. See User Defined Views for an overview of creating and configuring custom views.
Use SSL Configuration to adjust how Sync App handles TLS/SSL certificate negotiations. You can choose from various certificate formats; see the SSLServerCert property under "Connection String Options" for more information.
Configure the Sync App for compliance with Firewall and Proxy, including Windows proxies and HTTP proxies. You can also set up tunnel connections.
The Sync App offloads as much of the SELECT statement processing as possible to Elasticsearch and then processes the rest of the query in memory (client-side).
See Query Processing for more information.
See Logging for an overview of configuration settings that can be used to refine CData logging. For basic logging, you only need to set two connection properties, but there are numerous features that support more refined logging, where you can select subsets of information to be logged using the LogModules connection property.
By default, the Sync App attempts to negotiate SSL/TLS by checking the server's certificate against the system's trusted certificate store.
To specify another certificate, see the SSLServerCert property for the available formats to do so.
The Elasticsearch Sync App also supports setting client certificates. Set the following to connect using a client certificate.
To connect through the Windows system proxy, you do not need to set any additional connection properties. To connect to other proxies, set ProxyAutoDetect to false.
In addition, to authenticate to an HTTP proxy, set ProxyAuthScheme, ProxyUser, and ProxyPassword, in addition to ProxyServer and ProxyPort.
Set the following properties:
The CData Sync App models Elasticsearch entities in relational Tables, Views, and Stored Procedures.
Searching with SQL describes in further detail how the tables are dynamically retrieved.
Views are treated in a similar manner to Tables and thus exhibit similar behavior. There are some differences in the background though which are a direct result of how aliases work within Elasticsearch. (Note: In the following description, 'alias', 'index', 'type', and 'field' are referring to the Elasticsearch objects and not directly to anything within the Sync App).
Views (aliases) are tied to an index and thus span all the types within an index. Additionally aliases can span multiple indices. Therefore you may see an alias (view) listed multiple times under different schemas (index). When querying the view, regardless of the schema specified, data will be retrieved and returned for all indices and types associated with the corresponding alias. Thus the generated metadata will contain a column for each field within each type of each index associated with the alias.
Searching with SQL describes in further detail how the views are dynamically retrieved.
The ModifyIndexAliases stored procedure can be used to create index aliases within Elasticsearch.
In addition to the Elasticsearch aliases, an '_all' view is returned which enables querying the _all endpoint to retrieve data for all indices in a single query.
The Sync App maps types from the data source to the corresponding data type available in the schema. The table below documents these mappings.
Elasticsearch | CData Schema |
array | A JSON structure* |
binary | binary |
boolean | boolean |
byte | string |
completion | string |
date | datetime |
date_range | datetime (one field per value) |
double | double |
double_range | double (one field per value) |
float | float |
float_range | float (one field per value) |
geo_point | string |
geo_shape | string |
half_float | float |
integer | integer |
integer_range | integer (one field per value) |
ip | string |
keyword | string |
long | long |
long_range | long (one field per value) |
nested | A JSON structure.* |
object | Flattened into multiple fields. |
scaled_float | float |
short | short |
text> | string |
*Parsed into multiple fields with individual types (see FlattenArrays)
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider. Click the links for further details.
For more information on establishing a connection, see Establishing a Connection.
Property | Description |
AuthScheme | The scheme used for authentication. Accepted entries are None, Basic, Negotiate (Kerberos), AwsRootKeys, AwsIAMRoles, and APIKey. None is the default. |
User | The user who is authenticating to Elasticsearch. |
Password | The password used to authenticate to Elasticsearch. |
Server | The host name or IP address of the Elasticsearch REST server. Alternatively, multiple nodes in a single cluster can be specified, though all such nodes must be able to support REST API calls. |
Port | The port for the Elasticsearch REST server. |
APIKey | The APIKey used to authenticate to Elasticsearch. |
APIKeyId | The APIKey Id to authenticate to Elasticsearch. |
Property | Description |
DataModel | Specifies the data model to use when parsing Elasticsearch documents and generating the database metadata. |
Property | Description |
AWSAccessKey | Your AWS account access key. This value is accessible from your AWS security credentials page. |
AWSSecretKey | Your AWS account secret key. This value is accessible from your AWS security credentials page. |
AWSRoleARN | The Amazon Resource Name of the role to use when authenticating. |
AWSRegion | The hosting region for your Amazon Web Services. |
AWSSessionToken | Your AWS session token. |
TemporaryTokenDuration | The amount of time (in seconds) an AWS temporary token will last. |
AWSExternalId | A unique identifier that might be required when you assume a role in another account. |
Property | Description |
KerberosKDC | The Kerberos Key Distribution Center (KDC) service used to authenticate the user. |
KerberosRealm | The Kerberos Realm used to authenticate the user. |
KerberosSPN | The service principal name (SPN) for the Kerberos Domain Controller. |
KerberosKeytabFile | The Keytab file containing your pairs of Kerberos principals and encrypted keys. |
KerberosServiceRealm | The Kerberos realm of the service. |
KerberosServiceKDC | The Kerberos KDC of the service. |
KerberosTicketCache | The full file path to an MIT Kerberos credential cache file. |
Property | Description |
SSLClientCert | The TLS/SSL client certificate store for SSL Client Authentication (2-way SSL). |
SSLClientCertType | The type of key store containing the TLS/SSL client certificate. |
SSLClientCertPassword | The password for the TLS/SSL client certificate. |
SSLClientCertSubject | The subject of the TLS/SSL client certificate. |
SSLServerCert | The certificate to be accepted from the server when connecting using TLS/SSL. |
Property | Description |
FirewallType | The protocol used by a proxy-based firewall. |
FirewallServer | The name or IP address of a proxy-based firewall. |
FirewallPort | The TCP port for a proxy-based firewall. |
FirewallUser | The user name to use to authenticate with a proxy-based firewall. |
FirewallPassword | A password used to authenticate to a proxy-based firewall. |
Property | Description |
ProxyAutoDetect | This indicates whether to use the system proxy settings or not. This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings. |
ProxyServer | The hostname or IP address of a proxy to route HTTP traffic through. |
ProxyPort | The TCP port the ProxyServer proxy is running on. |
ProxyAuthScheme | The authentication type to use to authenticate to the ProxyServer proxy. |
ProxyUser | A user name to be used to authenticate to the ProxyServer proxy. |
ProxyPassword | A password to be used to authenticate to the ProxyServer proxy. |
ProxySSLType | The SSL type to use when connecting to the ProxyServer proxy. |
ProxyExceptions | A semicolon separated list of destination hostnames or IPs that are exempt from connecting through the ProxyServer . |
Property | Description |
LogModules | Core modules to be included in the log file. |
Property | Description |
Location | A path to the directory that contains the schema files defining tables, views, and stored procedures. |
BrowsableSchemas | This property restricts the schemas reported to a subset of the available schemas. For example, BrowsableSchemas=SchemaA,SchemaB,SchemaC. |
Tables | This property restricts the tables reported to a subset of the available tables. For example, Tables=TableA,TableB,TableC. |
Views | Restricts the views reported to a subset of the available tables. For example, Views=ViewA,ViewB,ViewC. |
FlattenObjects | Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of JSON. |
FlattenArrays | Set FlattenArrays to the number of nested array elements you want to return as table columns. By default, nested arrays are returned as strings of JSON. |
Property | Description |
ClientSideEvaluation | Set ClientSideEvaluation to true to perform Evaluation client side on nested objects. |
GenerateSchemaFiles | Indicates the user preference as to when schemas should be generated and saved. |
MaxResults | The maximum number of total results to return from Elasticsearch when using the default Search API. |
MaxRows | Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time. |
Other | These hidden properties are used only in specific use cases. |
PageSize | The number of results to return per request from Elasticsearch. |
PseudoColumns | This property indicates whether or not to include pseudo columns as columns to the table. |
QueryPassthrough | This option allows you to pass exact queries to Elasticsearch. |
RowScanDepth | The maximum number of rows to scan when generating table metadata. Set this property to gain more control over how the provider detects arrays. |
ScrollDuration | Specifies the time unit to use when retrieving results via the Scroll API. |
Timeout | The value in seconds until the timeout error is thrown, canceling the operation. |
UseFullyQualifiedNestedTableName | Set this to true to set the generated table name as the complete source path when flattening nested documents using Relational DataModel . |
UserDefinedViews | A filepath pointing to the JSON configuration file containing your custom views. |
This section provides a complete list of the Authentication properties you can configure in the connection string for this provider.
Property | Description |
AuthScheme | The scheme used for authentication. Accepted entries are None, Basic, Negotiate (Kerberos), AwsRootKeys, AwsIAMRoles, and APIKey. None is the default. |
User | The user who is authenticating to Elasticsearch. |
Password | The password used to authenticate to Elasticsearch. |
Server | The host name or IP address of the Elasticsearch REST server. Alternatively, multiple nodes in a single cluster can be specified, though all such nodes must be able to support REST API calls. |
Port | The port for the Elasticsearch REST server. |
APIKey | The APIKey used to authenticate to Elasticsearch. |
APIKeyId | The APIKey Id to authenticate to Elasticsearch. |
The scheme used for authentication. Accepted entries are None, Basic, Negotiate (Kerberos), AwsRootKeys, AwsIAMRoles, and APIKey. None is the default.
This field is used to authenticate against the server. Use the following options to select your authentication scheme:
The user who is authenticating to Elasticsearch.
The user who is authenticating to Elasticsearch.
The password used to authenticate to Elasticsearch.
The password used to authenticate to Elasticsearch.
The host name or IP address of the Elasticsearch REST server. Alternatively, multiple nodes in a single cluster can be specified, though all such nodes must be able to support REST API calls.
The host name or IP address of the Elasticsearch REST server. Alternatively, multiple nodes in a single cluster can be specified, though all such nodes must be able to support REST API calls.
To use SSL, prefix the host name or IP address with 'https://' and set SSL connection properties such as SSLServerCert.
To specify multiple nodes, set the property to a comma delimited list of addresses, with ports optionally specified after the address and delimited from the address by a colon. For example, you could specify two dedicated, coordinating nodes for your cluster with 'https://01.01.01.01:1234,https://02.02.02.02:5678'. If a port is specified with a node, that port will take precedence over the Port property for connections to that node only.
The port for the Elasticsearch REST server.
The port the Elasticsearch REST server is bound to.
The APIKey used to authenticate to Elasticsearch.
The APIKey used to authenticate to Elasticsearch.
The APIKey Id to authenticate to Elasticsearch.
The APIKey Id to authenticate to Elasticsearch.
This section provides a complete list of the Connection properties you can configure in the connection string for this provider.
Property | Description |
DataModel | Specifies the data model to use when parsing Elasticsearch documents and generating the database metadata. |
Specifies the data model to use when parsing Elasticsearch documents and generating the database metadata.
Select a DataModel configuration to configure how the Sync App models nested documents into tables. See Parsing Hierarchical Data for examples of querying the data in the different configurations.
The following DataModel configurations are available. See Parsing Hierarchical Data for examples of querying the data in the different configurations.
Document
Returns a single table representing a row for each document. In this data model, any nested documents will not be flattened and will be returned as aggregates.
FlattenedDocuments
Returns a single table representing a JOIN of the parent and nested documents. In this data model, nested documents will act in the same manner as a SQL JOIN. Additionally, nested sibling documents (nested documents at same height), will be treated as a SQL CROSS JOIN. The Sync App will identify the nested documents available by parsing the returned document.
Relational
Returns multiple tables, one for each nested document (including the parent document) in the document. In this data model, any nested documents will be returned as relational tables that contain a primary key and a foreign key that links to the parent table.
This section provides a complete list of the AWS Authentication properties you can configure in the connection string for this provider.
Property | Description |
AWSAccessKey | Your AWS account access key. This value is accessible from your AWS security credentials page. |
AWSSecretKey | Your AWS account secret key. This value is accessible from your AWS security credentials page. |
AWSRoleARN | The Amazon Resource Name of the role to use when authenticating. |
AWSRegion | The hosting region for your Amazon Web Services. |
AWSSessionToken | Your AWS session token. |
TemporaryTokenDuration | The amount of time (in seconds) an AWS temporary token will last. |
AWSExternalId | A unique identifier that might be required when you assume a role in another account. |
Your AWS account access key. This value is accessible from your AWS security credentials page.
Your AWS account access key. This value is accessible from your AWS security credentials page:
Your AWS account secret key. This value is accessible from your AWS security credentials page.
Your AWS account secret key. This value is accessible from your AWS security credentials page:
The Amazon Resource Name of the role to use when authenticating.
When authenticating outside of AWS, it is common to use a Role for authentication instead of your direct AWS account credentials. Entering the AWSRoleARN will cause the CData Sync App to perform a role based authentication instead of using the AWSAccessKey and AWSSecretKey directly. The AWSAccessKey and AWSSecretKey must still be specified to perform this authentication. You cannot use the credentials of an AWS root user when setting RoleARN. The AWSAccessKey and AWSSecretKey must be those of an IAM user.
The hosting region for your Amazon Web Services.
The hosting region for your Amazon Web Services. Available values are OHIO, NORTHERNVIRGINIA, NORTHERNCALIFORNIA, OREGON, CAPETOWN, HONGKONG, JAKARTA, MUMBAI, OSAKA, SEOUL, SINGAPORE, SYDNEY, TOKYO, CENTRAL, BEIJING, NINGXIA, FRANKFURT, IRELAND, LONDON, MILAN, PARIS, STOCKHOLM, ZURICH, BAHRAIN, UAE, SAOPAULO, GOVCLOUDEAST, and GOVCLOUDWEST.
Your AWS session token.
Your AWS session token. This value can be retrieved in different ways. See this link for more info.
The amount of time (in seconds) an AWS temporary token will last.
Temporary tokens are used with Role based authentication. Temporary tokens will eventually time out, at which time a new temporary token must be obtained. The CData Sync App will internally request a new temporary token once the temporary token has expired.
For Role based authentication, the minimum duration is 900 seconds (15 minutes) while the maximum if 3600 (1 hour).
A unique identifier that might be required when you assume a role in another account.
A unique identifier that might be required when you assume a role in another account.
This section provides a complete list of the Kerberos properties you can configure in the connection string for this provider.
Property | Description |
KerberosKDC | The Kerberos Key Distribution Center (KDC) service used to authenticate the user. |
KerberosRealm | The Kerberos Realm used to authenticate the user. |
KerberosSPN | The service principal name (SPN) for the Kerberos Domain Controller. |
KerberosKeytabFile | The Keytab file containing your pairs of Kerberos principals and encrypted keys. |
KerberosServiceRealm | The Kerberos realm of the service. |
KerberosServiceKDC | The Kerberos KDC of the service. |
KerberosTicketCache | The full file path to an MIT Kerberos credential cache file. |
The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
The Kerberos properties are used when using SPNEGO or Windows Authentication. The Sync App will request session tickets and temporary session keys from the Kerberos KDC service. The Kerberos KDC service is conventionally colocated with the domain controller.
If Kerberos KDC is not specified, the Sync App will attempt to detect these properties automatically from the following locations:
The Kerberos Realm used to authenticate the user.
The Kerberos properties are used when using SPNEGO or Windows Authentication. The Kerberos Realm is used to authenticate the user with the Kerberos Key Distribution Service (KDC). The Kerberos Realm can be configured by an administrator to be any string, but conventionally it is based on the domain name.
If Kerberos Realm is not specified, the Sync App will attempt to detect these properties automatically from the following locations:
The service principal name (SPN) for the Kerberos Domain Controller.
If the SPN on the Kerberos Domain Controller is not the same as the URL that you are authenticating to, use this property to set the SPN.
The Keytab file containing your pairs of Kerberos principals and encrypted keys.
The Keytab file containing your pairs of Kerberos principals and encrypted keys.
The Kerberos realm of the service.
The KerberosServiceRealm is the specify the service Kerberos realm when using cross-realm Kerberos authentication.
In most cases, a single realm and KDC machine are used to perform the Kerberos authentication and this property is not required.
This property is available for complex setups where a different realm and KDC machine are used to obtain an authentication ticket (AS request) and a service ticket (TGS request).
The Kerberos KDC of the service.
The KerberosServiceKDC is used to specify the service Kerberos KDC when using cross-realm Kerberos authentication.
In most cases, a single realm and KDC machine are used to perform the Kerberos authentication and this property is not required.
This property is available for complex setups where a different realm and KDC machine are used to obtain an authentication ticket (AS request) and a service ticket (TGS request).
The full file path to an MIT Kerberos credential cache file.
This property can be set if you wish to use a credential cache file that was created using the MIT Kerberos Ticket Manager or kinit command.
This section provides a complete list of the SSL properties you can configure in the connection string for this provider.
Property | Description |
SSLClientCert | The TLS/SSL client certificate store for SSL Client Authentication (2-way SSL). |
SSLClientCertType | The type of key store containing the TLS/SSL client certificate. |
SSLClientCertPassword | The password for the TLS/SSL client certificate. |
SSLClientCertSubject | The subject of the TLS/SSL client certificate. |
SSLServerCert | The certificate to be accepted from the server when connecting using TLS/SSL. |
The TLS/SSL client certificate store for SSL Client Authentication (2-way SSL).
The name of the certificate store for the client certificate.
The SSLClientCertType field specifies the type of the certificate store specified by SSLClientCert. If the store is password protected, specify the password in SSLClientCertPassword.
SSLClientCert is used in conjunction with the SSLClientCertSubject field in order to specify client certificates. If SSLClientCert has a value, and SSLClientCertSubject is set, a search for a certificate is initiated. See SSLClientCertSubject for more information.
Designations of certificate stores are platform-dependent.
The following are designations of the most common User and Machine certificate stores in Windows:
MY | A certificate store holding personal certificates with their associated private keys. |
CA | Certifying authority certificates. |
ROOT | Root certificates. |
SPC | Software publisher certificates. |
In Java, the certificate store normally is a file containing certificates and optional private keys.
When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (for example, PKCS12 certificate store).
The type of key store containing the TLS/SSL client certificate.
This property can take one of the following values:
USER - default | For Windows, this specifies that the certificate store is a certificate store owned by the current user. Note that this store type is not available in Java. |
MACHINE | For Windows, this specifies that the certificate store is a machine store. Note that this store type is not available in Java. |
PFXFILE | The certificate store is the name of a PFX (PKCS12) file containing certificates. |
PFXBLOB | The certificate store is a string (base-64-encoded) representing a certificate store in PFX (PKCS12) format. |
JKSFILE | The certificate store is the name of a Java key store (JKS) file containing certificates. Note that this store type is only available in Java. |
JKSBLOB | The certificate store is a string (base-64-encoded) representing a certificate store in JKS format. Note that this store type is only available in Java. |
PEMKEY_FILE | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
PEMKEY_BLOB | The certificate store is a string (base64-encoded) that contains a private key and an optional certificate. |
PUBLIC_KEY_FILE | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
PUBLIC_KEY_BLOB | The certificate store is a string (base-64-encoded) that contains a PEM- or DER-encoded public key certificate. |
SSHPUBLIC_KEY_FILE | The certificate store is the name of a file that contains an SSH-style public key. |
SSHPUBLIC_KEY_BLOB | The certificate store is a string (base-64-encoded) that contains an SSH-style public key. |
P7BFILE | The certificate store is the name of a PKCS7 file containing certificates. |
PPKFILE | The certificate store is the name of a file that contains a PuTTY Private Key (PPK). |
XMLFILE | The certificate store is the name of a file that contains a certificate in XML format. |
XMLBLOB | The certificate store is a string that contains a certificate in XML format. |
The password for the TLS/SSL client certificate.
If the certificate store is of a type that requires a password, this property is used to specify that password to open the certificate store.
The subject of the TLS/SSL client certificate.
When loading a certificate the subject is used to locate the certificate in the store.
If an exact match is not found, the store is searched for subjects containing the value of the property. If a match is still not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks the first certificate in the certificate store.
The certificate subject is a comma separated list of distinguished name fields and values. For example, "CN=www.server.com, OU=test, C=US, [email protected]". The common fields and their meanings are shown below.
Field | Meaning |
CN | Common Name. This is commonly a host name like www.server.com. |
O | Organization |
OU | Organizational Unit |
L | Locality |
S | State |
C | Country |
E | Email Address |
If a field value contains a comma, it must be quoted.
The certificate to be accepted from the server when connecting using TLS/SSL.
If using a TLS/SSL connection, this property can be used to specify the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine is rejected.
This property can take the following forms:
Description | Example |
A full PEM Certificate (example shortened for brevity) | -----BEGIN CERTIFICATE----- MIIChTCCAe4CAQAwDQYJKoZIhv......Qw== -----END CERTIFICATE----- |
A path to a local file containing the certificate | C:\cert.cer |
The public key (example shortened for brevity) | -----BEGIN RSA PUBLIC KEY----- MIGfMA0GCSq......AQAB -----END RSA PUBLIC KEY----- |
The MD5 Thumbprint (hex values can also be either space or colon separated) | ecadbdda5a1529c58a1e9e09828d70e4 |
The SHA1 Thumbprint (hex values can also be either space or colon separated) | 34a929226ae0819f2ec14b4a3d904f801cbb150d |
If not specified, any certificate trusted by the machine is accepted.
Use '*' to signify to accept all certificates. Note that this is not recommended due to security concerns.
This section provides a complete list of the Firewall properties you can configure in the connection string for this provider.
Property | Description |
FirewallType | The protocol used by a proxy-based firewall. |
FirewallServer | The name or IP address of a proxy-based firewall. |
FirewallPort | The TCP port for a proxy-based firewall. |
FirewallUser | The user name to use to authenticate with a proxy-based firewall. |
FirewallPassword | A password used to authenticate to a proxy-based firewall. |
The protocol used by a proxy-based firewall.
This property specifies the protocol that the Sync App will use to tunnel traffic through the FirewallServer proxy. Note that by default, the Sync App connects to the system proxy; to disable this behavior and connect to one of the following proxy types, set ProxyAutoDetect to false.
Type | Default Port | Description |
TUNNEL | 80 | When this is set, the Sync App opens a connection to Elasticsearch and traffic flows back and forth through the proxy. |
SOCKS4 | 1080 | When this is set, the Sync App sends data through the SOCKS 4 proxy specified by FirewallServer and FirewallPort and passes the FirewallUser value to the proxy, which determines if the connection request should be granted. |
SOCKS5 | 1080 | When this is set, the Sync App sends data through the SOCKS 5 proxy specified by FirewallServer and FirewallPort. If your proxy requires authentication, set FirewallUser and FirewallPassword to credentials the proxy recognizes. |
To connect to HTTP proxies, use ProxyServer and ProxyPort. To authenticate to HTTP proxies, use ProxyAuthScheme, ProxyUser, and ProxyPassword.
The name or IP address of a proxy-based firewall.
This property specifies the IP address, DNS name, or host name of a proxy allowing traversal of a firewall. The protocol is specified by FirewallType: Use FirewallServer with this property to connect through SOCKS or do tunneling. Use ProxyServer to connect to an HTTP proxy.
Note that the Sync App uses the system proxy by default. To use a different proxy, set ProxyAutoDetect to false.
The TCP port for a proxy-based firewall.
This specifies the TCP port for a proxy allowing traversal of a firewall. Use FirewallServer to specify the name or IP address. Specify the protocol with FirewallType.
The user name to use to authenticate with a proxy-based firewall.
The FirewallUser and FirewallPassword properties are used to authenticate against the proxy specified in FirewallServer and FirewallPort, following the authentication method specified in FirewallType.
A password used to authenticate to a proxy-based firewall.
This property is passed to the proxy specified by FirewallServer and FirewallPort, following the authentication method specified by FirewallType.
This section provides a complete list of the Proxy properties you can configure in the connection string for this provider.
Property | Description |
ProxyAutoDetect | This indicates whether to use the system proxy settings or not. This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings. |
ProxyServer | The hostname or IP address of a proxy to route HTTP traffic through. |
ProxyPort | The TCP port the ProxyServer proxy is running on. |
ProxyAuthScheme | The authentication type to use to authenticate to the ProxyServer proxy. |
ProxyUser | A user name to be used to authenticate to the ProxyServer proxy. |
ProxyPassword | A password to be used to authenticate to the ProxyServer proxy. |
ProxySSLType | The SSL type to use when connecting to the ProxyServer proxy. |
ProxyExceptions | A semicolon separated list of destination hostnames or IPs that are exempt from connecting through the ProxyServer . |
This indicates whether to use the system proxy settings or not. This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings.
This takes precedence over other proxy settings, so you'll need to set ProxyAutoDetect to FALSE in order use custom proxy settings.
To connect to an HTTP proxy, see ProxyServer. For other proxies, such as SOCKS or tunneling, see FirewallType.
The hostname or IP address of a proxy to route HTTP traffic through.
The hostname or IP address of a proxy to route HTTP traffic through. The Sync App can use the HTTP, Windows (NTLM), or Kerberos authentication types to authenticate to an HTTP proxy.
If you need to connect through a SOCKS proxy or tunnel the connection, see FirewallType.
By default, the Sync App uses the system proxy. If you need to use another proxy, set ProxyAutoDetect to false.
The TCP port the ProxyServer proxy is running on.
The port the HTTP proxy is running on that you want to redirect HTTP traffic through. Specify the HTTP proxy in ProxyServer. For other proxy types, see FirewallType.
The authentication type to use to authenticate to the ProxyServer proxy.
This value specifies the authentication type to use to authenticate to the HTTP proxy specified by ProxyServer and ProxyPort.
Note that the Sync App will use the system proxy settings by default, without further configuration needed; if you want to connect to another proxy, you will need to set ProxyAutoDetect to false, in addition to ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
The authentication type can be one of the following:
If you need to use another authentication type, such as SOCKS 5 authentication, see FirewallType.
A user name to be used to authenticate to the ProxyServer proxy.
The ProxyUser and ProxyPassword options are used to connect and authenticate against the HTTP proxy specified in ProxyServer.
You can select one of the available authentication types in ProxyAuthScheme. If you are using HTTP authentication, set this to the user name of a user recognized by the HTTP proxy. If you are using Windows or Kerberos authentication, set this property to a user name in one of the following formats:
user@domain domain\user
A password to be used to authenticate to the ProxyServer proxy.
This property is used to authenticate to an HTTP proxy server that supports NTLM (Windows), Kerberos, or HTTP authentication. To specify the HTTP proxy, you can set ProxyServer and ProxyPort. To specify the authentication type, set ProxyAuthScheme.
If you are using HTTP authentication, additionally set ProxyUser and ProxyPassword to HTTP proxy.
If you are using NTLM authentication, set ProxyUser and ProxyPassword to your Windows password. You may also need these to complete Kerberos authentication.
For SOCKS 5 authentication or tunneling, see FirewallType.
By default, the Sync App uses the system proxy. If you want to connect to another proxy, set ProxyAutoDetect to false.
The SSL type to use when connecting to the ProxyServer proxy.
This property determines when to use SSL for the connection to an HTTP proxy specified by ProxyServer. This value can be AUTO, ALWAYS, NEVER, or TUNNEL. The applicable values are the following:
AUTO | Default setting. If the URL is an HTTPS URL, the Sync App will use the TUNNEL option. If the URL is an HTTP URL, the component will use the NEVER option. |
ALWAYS | The connection is always SSL enabled. |
NEVER | The connection is not SSL enabled. |
TUNNEL | The connection is through a tunneling proxy. The proxy server opens a connection to the remote host and traffic flows back and forth through the proxy. |
A semicolon separated list of destination hostnames or IPs that are exempt from connecting through the ProxyServer .
The ProxyServer is used for all addresses, except for addresses defined in this property. Use semicolons to separate entries.
Note that the Sync App uses the system proxy settings by default, without further configuration needed; if you want to explicitly configure proxy exceptions for this connection, you need to set ProxyAutoDetect = false, and configure ProxyServer and ProxyPort. To authenticate, set ProxyAuthScheme and set ProxyUser and ProxyPassword, if needed.
This section provides a complete list of the Logging properties you can configure in the connection string for this provider.
Property | Description |
LogModules | Core modules to be included in the log file. |
Core modules to be included in the log file.
Only the modules specified (separated by ';') will be included in the log file. By default all modules are included.
See the Logging page for an overview.
This section provides a complete list of the Schema properties you can configure in the connection string for this provider.
Property | Description |
Location | A path to the directory that contains the schema files defining tables, views, and stored procedures. |
BrowsableSchemas | This property restricts the schemas reported to a subset of the available schemas. For example, BrowsableSchemas=SchemaA,SchemaB,SchemaC. |
Tables | This property restricts the tables reported to a subset of the available tables. For example, Tables=TableA,TableB,TableC. |
Views | Restricts the views reported to a subset of the available tables. For example, Views=ViewA,ViewB,ViewC. |
FlattenObjects | Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of JSON. |
FlattenArrays | Set FlattenArrays to the number of nested array elements you want to return as table columns. By default, nested arrays are returned as strings of JSON. |
A path to the directory that contains the schema files defining tables, views, and stored procedures.
The path to a directory which contains the schema files for the Sync App (.rsd files for tables and views, .rsb files for stored procedures). The folder location can be a relative path from the location of the executable. The Location property is only needed if you want to customize definitions (for example, change a column name, ignore a column, and so on) or extend the data model with new tables, views, or stored procedures.
If left unspecified, the default location is "%APPDATA%\\CData\\Elasticsearch Data Provider\\Schema" with %APPDATA% being set to the user's configuration directory:
This property restricts the schemas reported to a subset of the available schemas. For example, BrowsableSchemas=SchemaA,SchemaB,SchemaC.
Listing the schemas from databases can be expensive. Providing a list of schemas in the connection string improves the performance.
This property restricts the tables reported to a subset of the available tables. For example, Tables=TableA,TableB,TableC.
Listing the tables from some databases can be expensive. Providing a list of tables in the connection string improves the performance of the Sync App.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the tables you want in a comma-separated list. Each table should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Tables=TableA,[TableB/WithSlash],WithCatalog.WithSchema.`TableC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
Restricts the views reported to a subset of the available tables. For example, Views=ViewA,ViewB,ViewC.
Listing the views from some databases can be expensive. Providing a list of views in the connection string improves the performance of the Sync App.
This property can also be used as an alternative to automatically listing views if you already know which ones you want to work with and there would otherwise be too many to work with.
Specify the views you want in a comma-separated list. Each view should be a valid SQL identifier with any special characters escaped using square brackets, double-quotes or backticks. For example, Views=ViewA,[ViewB/WithSlash],WithCatalog.WithSchema.`ViewC With Space`.
Note that when connecting to a data source with multiple schemas or catalogs, you will need to provide the fully qualified name of the table in this property, as in the last example here, to avoid ambiguity between tables that exist in multiple catalogs or schemas.
Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of JSON.
Set FlattenObjects to true to flatten object properties into columns of their own. Otherwise, objects nested in arrays are returned as strings of JSON. The property name is concatenated onto the object name with a period to generate the column name.
For example, you can flatten the nested objects below at connection time:
"manager": { "name": "Alice White", "age": 30 }When FlattenObjects is set to true, the preceding object is flattened into the following table:
Column Name | Column Value |
manager.name | Alice White |
manager.age | 30 |
Set FlattenArrays to the number of nested array elements you want to return as table columns. By default, nested arrays are returned as strings of JSON.
By default, nested arrays are returned as strings of JSON. The FlattenArrays property can be used to flatten the elements of nested arrays into columns of their own. This is only recommended for arrays that are expected to be short.
Set FlattenArrays to the number of elements you want to return from nested arrays. The specified elements are returned as columns. The zero-based index is concatenated to the column name. Other elements are ignored.
For example, you can return an arbitrary number of elements from an array of strings:
"employees": [ { "name": "John Smith", "age": 34 }, { "name": "Peter Brown", "age": 26 }, { "name": "Paul Jacobs", "age": 30 } ]When FlattenArrays is set to 2, the preceding array is flattened into the following table:
Column Name | Column Value |
employees.0.name | John Smith |
employees.0.age | 34 |
employees.1.name | Peter Brown |
employees.1.age | 26 |
See JSON Functions to use JSON paths to work with unbounded arrays.
This section provides a complete list of the Miscellaneous properties you can configure in the connection string for this provider.
Property | Description |
ClientSideEvaluation | Set ClientSideEvaluation to true to perform Evaluation client side on nested objects. |
GenerateSchemaFiles | Indicates the user preference as to when schemas should be generated and saved. |
MaxResults | The maximum number of total results to return from Elasticsearch when using the default Search API. |
MaxRows | Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time. |
Other | These hidden properties are used only in specific use cases. |
PageSize | The number of results to return per request from Elasticsearch. |
PseudoColumns | This property indicates whether or not to include pseudo columns as columns to the table. |
QueryPassthrough | This option allows you to pass exact queries to Elasticsearch. |
RowScanDepth | The maximum number of rows to scan when generating table metadata. Set this property to gain more control over how the provider detects arrays. |
ScrollDuration | Specifies the time unit to use when retrieving results via the Scroll API. |
Timeout | The value in seconds until the timeout error is thrown, canceling the operation. |
UseFullyQualifiedNestedTableName | Set this to true to set the generated table name as the complete source path when flattening nested documents using Relational DataModel . |
UserDefinedViews | A filepath pointing to the JSON configuration file containing your custom views. |
Set ClientSideEvaluation to true to perform Evaluation client side on nested objects.
Set ClientSideEvaluation to true to perform Evaluation (GROUP BY, filtering) client side on nested objects.
For example, with ClientSideEvaluation set to false(default value), GROUP BY on nested object 'property.0.name' would be grouped as 'property.*.name', while if set to true, results would be grouped as 'property.0.name'.
Similarly, with ClientSideEvaluation set to false(default value), filtering on nested object 'property.0.name' would be filtered as 'property.*.name', while if set to true, results would be filtered as 'property.0.name'.
This would affect performance as query is evaluated client side.
Indicates the user preference as to when schemas should be generated and saved.
This property outputs schemas to .rsd files in the path specified by Location.
Available settings are the following:
When you set GenerateSchemaFiles to OnUse, the Sync App generates schemas as you execute SELECT queries. Schemas are generated for each table referenced in the query.
When you set GenerateSchemaFiles to OnCreate, schemas are only generated when a CREATE TABLE query is executed.
Another way to use this property is to obtain schemas for every table in your database when you connect. To do so, set GenerateSchemaFiles to OnStart and connect.
The maximum number of total results to return from Elasticsearch when using the default Search API.
This property corresponds to the Elasticsearch index.max_result_window index setting. Thus the default value is 10000, which is Elasticsearch's default limit.
This value is not applicable when using the Scroll API. Set ScrollDuration to use this API.
When a LIMIT is specified in a query, the LIMIT will be taken into account provided it is less than MaxResults. Otherwise the number of results returned will be limited to the MaxResults value.
If you receive an error stating that the result window is too large, this is caused by the MaxResults value being greater than the Elasticsearch index.max_result_window index setting. You can either change the MaxResults value to match the index.max_result_window index setting or use the Scroll API by setting ScrollDuration.
Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time.
Limits the number of rows returned rows when no aggregation or group by is used in the query. This helps avoid performance issues at design time.
These hidden properties are used only in specific use cases.
The properties listed below are available for specific use cases. Normal driver use cases and functionality should not require these properties.
Specify multiple properties in a semicolon-separated list.
DefaultColumnSize | Sets the default length of string fields when the data source does not provide column length in the metadata. The default value is 2000. |
ConvertDateTimeToGMT | Determines whether to convert date-time values to GMT, instead of the local time of the machine. |
RecordToFile=filename | Records the underlying socket data transfer to the specified file. |
The number of results to return per request from Elasticsearch.
The PageSize can control the number of results received per request from Elasticsearch on a given query.
The default value is 10000, which is Elasticsearch's default limit (based on the Elasticsearch index.max_result_window index setting).
This property indicates whether or not to include pseudo columns as columns to the table.
This setting is particularly helpful in Entity Framework, which does not allow you to set a value for a pseudo column unless it is a table column. The value of this connection setting is of the format "Table1=Column1, Table1=Column2, Table2=Column3". You can use the "*" character to include all tables and all columns; for example, "*=*".
This option allows you to pass exact queries to Elasticsearch.
Setting this property to True enables the Sync App to pass an Elasticsearch query as-is to Elasticsearch. There are two options for submitting as-is queries to Elasticsearch: SQL and Search DSL.
SQL API
Elasticsearch version 6.3 and above supports a SQL API endpoint. When set to true, this option allows you to pass SQL queries directly to the Elasticsearch SQL API. Columns will be identified based on the metadata returned in the response.
Supported SQL syntax and commands can be found in the Elasticsearch documentation.
Note: SQL functionality is limited to what is supported by Elasticsearch.
Search DSL
Alternatively, queries can be submitted using Elasticsearch's Search DSL language, which includes Query DSL. This functionality is available in all versions of Elasticsearch.
The supported query syntax is JSON using the query passthrough syntax described below.
The JSON Passthrough Query Syntax supports the following elements:
Element Name | Function |
index | The Elasticsearch index (or schema) to query. This is a JSON element that takes a string value. |
type | The Elasticsearch type (or table) to query within index. This is a JSON element that takes a string value. |
docid | The Id of the document to query within index.type. This is a JSON element that takes a string value. |
apiendpoint | The Elasticsearch API Endpoint to query. Default value is '_search'. This is a JSON element that takes a string value. |
requestdata | The raw Elasticsearch Search DSL that will be sent to Elasticsearch as is. The value is a JSON object that maps directly to the format required by Elasticsearch. |
The index, type, docid, and apiendpoint are used to generate the URL where the requestdata will be sent. The URL is generated using the following format: [Server]:[Port]/[index]/[type]/[docid]/[apiendpoint]. If any of the JSON passthrough elements are not specified, they will not be added to the URL.
Below is an example of a passthrough query. This example will retrieve the first 10 documents from megacorp.employee that contain a last_name of 'smith'. The results will be ordered by first_name in descending order.
{ "index": "megacorp", "type": "employee", "requestdata": { "from": 0, "size": 10, "query": {"bool":{"must":{"term":{"last_name":"smith"}}}}, "sort": {"first_name":{"order":"desc"}} } }
When using QueryPassthrough queries, the metadata is determined by the data returned in the response. RowScanDepth identifies the depth of the records that will be scanned to determine the metadata (columns and types). Since the metadata is based on the response data, passthrough queries may display different metadata than a similar query performed using the SQL syntax (where the metadata is retrieved directly from Elasticsearch).
The maximum number of rows to scan when generating table metadata. Set this property to gain more control over how the provider detects arrays.
This property is used when generating table metadata and specifically is used to identify arrays within the data. Elasticsearch allows any field to be an array and does not identify which fields are arrays in the mapping data. Thus RowScanDepth rows will be queried and scanned to identify if any of the fields contain arrays.
When QueryPassthrough is set to True, the columns in a table must be determined by scanning the data returned in the request. This value determines the maximum number of rows that will be scanned to determine the table metadata. The default value is 100.
Setting a high value may decrease performance. Setting a low value may prevent the data type from being determined properly, especially when there is null data.
Specifies the time unit to use when retrieving results via the Scroll API.
When a nonzero value is specified, the Scroll API will be used.
The time unit specified will be sent in each request made to Elasticsearch to specify how long the server should keep the search context alive. The value specified only needs to be long enough to process the previous batch of results (not to process all the data). This is because the ScrollDuration value will be sent in each request, which will extend the context time.
Once all the results have been retrieved, the search context will be cleared.
The format for this value is: [integer][time unit]. For example: 1m = 1 minute.
Setting this property to '0' will cause the default Search API to be used. In such a case, the maximum number of results that can be returned are equal to MaxResults.
Supported Time Units:
Value | Description |
y | Year |
M | Month |
w | Week |
d | Day |
h | Hour |
m | Minute |
s | Second |
ms | Milli-second |
The value in seconds until the timeout error is thrown, canceling the operation.
If Timeout = 0, operations do not time out. The operations run until they complete successfully or until they encounter an error condition.
If Timeout expires and the operation is not yet complete, the Sync App throws an exception.
Set this to true to set the generated table name as the complete source path when flattening nested documents using Relational DataModel .
Set this to true to set the generated table name as the complete source path when flattening nested documents using Relational DataModel.
A filepath pointing to the JSON configuration file containing your custom views.
User Defined Views are defined in a JSON-formatted configuration file called UserDefinedViews.json. The Sync App automatically detects the views specified in this file.
You can also have multiple view definitions and control them using the UserDefinedViews connection property. When you use this property, only the specified views are seen by the Sync App.
This User Defined View configuration file is formatted as follows:
For example:
{ "MyView": { "query": "SELECT * FROM [CData].[Elasticsearch].Employee WHERE MyColumn = 'value'" }, "MyView2": { "query": "SELECT * FROM MyTable WHERE Id IN (1,2,3)" } }Use the UserDefinedViews connection property to specify the location of your JSON configuration file. For example:
"UserDefinedViews", "C:\\Users\\yourusername\\Desktop\\tmp\\UserDefinedViews.json"