The Self-Service Analytics Elasticsearch connector lets you access the data available in the Elasticsearch storage using the Self-Service Analytics client. The Self-Service Analytics Elasticsearch connector supports the following Elasticsearch versions.
-
Elasticsearch 7.0 - 7.17
Use the Elasticsearch 7 connector to connect to OpenSearch earlier than 2.x. To connect to OpenSearch 2.x and higher, use the OpenSearch connector.
-
Elasticsearch 8.1 - 8.17
You cannot import or export Elasticsearch data sources (or the visuals and dashboards that use those Elasticsearch data sources) if the version of the Elasticsearch connector in the Self-Service Analytics environment is different from the version used by the data sources. For example, you cannot import an Elasticsearch 7 data source you have exported if your Self-Service Analytics environment only has an Elasticsearch 8 connector defined. When you change connector versions in your Self-Service Analytics environment, we recommend that you also create new data source configurations (and associated visuals and dashboards) for the newer version.
Before you can establish a connection from Self-Service Analytics to Elasticsearch storage, a connector server needs to be installed and configured. See Manage Connectors and Connector Servers for general instructions and Connect to Elasticsearch for details specific to the Elasticsearch connector.
After setting up the connector, create data sources that specify the necessary connection information and identify the data you want to use. See Create and Manage Data Sources for more information. After you set up your data sources, create dashboards, self service reports, and visuals from the data in these data sources.
This section covers the following topics:
Connect to Elasticsearch
When establishing a connection to an Elasticsearch data store, make sure you:
-
Specify the connection string in the following format:
where
<schema> is the protocol that you want to use:
http or https (with SSL support)
transport or transports (with SSL support)
-
Specify your Elasticsearch cluster name.
-
If required, specify your Elasticsearch User Name and Password.
-
Select Validate to confirm your connection.
To connect to your Elasticsearch cluster and data set secured by X-Pack, see Support of X-Pack for Elasticsearch.
If your Elasticsearch cluster is configured with a custom certificate, you should configure a truststore for the Elasticsearch connector.
Connect to an Elasticsearch data store with a configured custom certificate
-
Copy a truststore to the machine on which the Elasticsearch connector is running.
-
Add the following lines to file the appropriate Elasticsearch
jvm file.
- For Linux:
/etc/zoomdata/edc-elasticsearch-7.0.jvm, or /etc/zoomdata/edc-elasticsearch-8.0.jvm. Copy these files from the /opt/zoomdata/conf directory if a copy is not in /etc/zoomdata/.
- For Windows:
<install-path>/edc-elasticsearch-7.0.jvm or <install-path>/edc-elasticsearch-8.0.jvm. Copy these files from the <install-path>/conf directory if a copy is not in <install-path>.
Replace:
<path_to_truststore> with an absolute path to your truststore
<truststore_password> with a password for your truststore
Connect to Elasticsearch Using Amazon Web Services Authentication
You can connect the Self-Service Analytics Elasticsearch connectors to your Elasticsearch data store using Amazon Web Services (AWS) credentials. After connecting, the Self-Service Analytics Elasticsearch connectors work with AWS Elasticsearch without any restrictions.
AWS does not support Elasticsearch v8.0.
Connect the Elasticsearch connector to your Elasticsearch data store using AWS authentication:
-
Specify the AWS credentials in a standard AWS-format credentials file (see Format of the credentials file) and store the file in the Elasticsearch connector’s file system.
-
Edit the Elasticsearch properties file (
edc-elasticsearch-7.0.properties) and locate or add the elasticsearch.aws.show-aws-connection-params property to the file. This property indicates whether AWS-specific connection parameters should be shown when a new connector is created or the connection properties of an existing connector are refreshed. Valid values are true or false. The default is false (users will not see new AWS connection parameters).
Set the value of this property to true and save the properties file. For more information about Self-Service Analytics properties files, see Configuration Property Files.
-
Create a new Elasticsearch connection or edit an existing one (see Add Data Store Connections).
The AWS connection parameters appear in the UI. Supply values for them as described in the following table.
-
After you have specified all parameters necessary for the connection definition, save it. See Add Data Store Connections.
Elasticsearch 7 Composite Aggregation
Composite aggregations are implemented by Elasticsearch 7 connectors. This support optimizes aggregations of Elasticsearch 7 data, except for queries with:
- histograms
- time groups with WEEK granularity
- multiple groups when group fields belong to different nested contexts.
An Elasticsearch 7 configuration property elasticsearch.query.composite-agg.max-fetch-size in the Elasticsearch 7 configuration file (edc-elasticsearch-7.0.properties) can be used to specify the maximum number of buckets to return for each query within a composite aggregation.
Valid values must be greater than zero; the default value is 10000. This property corresponds to the Elasticsearch setting search.max_buckets, that also has a default value of 10000.
If you elect to increase the value of the elasticsearch.query.composite-agg.max-fetch-size property, be sure to correspondingly increase the value of the Elasticsearch search.max_buckets setting.
Distinct Counts and Percentiles in Elasticsearch
Distinct count and percentiles metrics return approximate values in Elasticsearch. The precision of the result returned by distinct count metric depends on the precision threshold setting (default value is 1000).
You can change the value of the precision threshold by setting the elasticsearch.query.cardinality.precision.threshold property in the zoomdata.properties file.
See Elasticsearch’s documentation on the following for more information:
The table below lists all available properties that you can modify to work with Elasticsearch.
If you need to change the default settings, add the corresponding properties (listed above) to the zoomdata.properties file and assign the required values. For more details, see Connector Properties and Property Files.
Elasticsearch Data Source Configuration Notes
When setting up an Elasticsearch-based data source, select the indices and aliases to be queried, and select the fields to be handled. You can do this in three steps:
-
Select indices and aliases to be queried on the Source Creation tab.
-
Select indices Manually or Automatically.
-
If you want to get the data only from specific indices, select the Manually option and choose the corresponding indices from the list Select Indices.
-
The Automatically option is more flexible. It lets you set the pattern by which the indices will be selected automatically.
For this option, you can select one of the pattern types. Note that when no indices match the pattern while querying, your visuals are returned empty.
-
Native - specify the pattern for index names. Use an asterisk (*) to replace one character or a set of characters.
For example, you want to get all the indices whose name starts with log and ends with 16. In this case, specify the following pattern:
-
Time Based - set the time pattern to get the matching indices. Check the supported date and time patterns.
For example, the time pattern YYYY-MM will return all the indices, whose name will match the pattern in the following examples. Note that if the Index Name includes text with the time and date pattern, you need to enclose the text portion in brackets [ ]:
Examples:
The fields for indexes are not refreshed. If new fields are added to your data source, they are added to Self-Service Analytics only after you select the Manual Refresh (
) button on the Cache tab of the data source. If there are some changes in the existing fields (for example, if a field has been removed) they will not be applied.
Filtering by type is not supported.
When you connect to your Elasticsearch data source, the additional service field type is added. The type field contains all the selected Elasticsearch types you can visualize as attributes on your visuals.
Elasticsearch Connector Feature Support
Connector support for specific features is shown in the following table.
Key: Y - Supported; N - Not Supported; N/A - not applicable
Inner Hits Configuration Property
Use the Self-Service Analytics Elasticsearch elasticsearch.inner-hits.size property to specify the maximum number of hits to return per inner_hits query (used for raw data requests involving nested fields). The default value is 100.
If you specify a value that is too small, the number of values returned for a nested field in a document with a large number of sub-documents may be limited. If you specify a value that is too large, excessive memory may be consumed.
Elasticsearch Connector IP Address Data Type Support
The IP Address data type is supported for Elasticsearch data connectors. Fields of this type are treated as ATTRIBUTEs and can be used in:
- An Elasticsearch text search box. When searching via the text search, Self-Service Analytics also supports the CIDR notation for IP addresses as described in the Elasticsearch documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/ip.html).
- The Group By selection box.
- Filters, although Self-Service Analytics does not support CIDR notation in filters for an IP address field. An exact match is required.
- Row-level expressions. In row-level expressions, Self-Service Analytics treats IP addresses as strings and expect an exact match.
Elasticsearch Last Value Processing
There are situations in which the Elasticsearch connector cannot compute the Last Value metric correctly.
-
When the original value is available for a metric field, an error appears in either of the following situations:
- Both metric and group fields are nested and related.
- Both metric and time fields are nested and related.
The Elasticsearch connector still may not always choose the maximum value among several values for the Last Value of a time field. This should happen only in the following cases:
- When the metric field is nested and neither the group or time field is located in the same hierarchy (group and time fields are either at the root level or belong to another hierarchy)
- When the Last Value is an array.
-
When the original value is not available for a metric field (the result is fetched from doc values or stored fields), an error appears when the metric field is nested and the time field is not located on the same or lower level in the hierarchy.
The Elasticsearch connector still may not always choose the maximum value among several values for the Last Value of a time field. This should happen only when the Last Value is an array.
Elasticsearch Source Document Storage Configurations
Elasticsearch data stores generally store the original JSON source documents passed when Elasticsearch performs its document indexing in the _source field in the index. However, some organizations disable the _source field to save storage and thus do not store the original JSON source documents.
Self-Service Analytics Elasticsearch 7 and 8 connectors support Elasticsearch data stores with any of the following source document configurations:
-
Source documents disabled. For example:
-
Source documents enabled, but with some source exclusions. For example:
-
Source documents enabled, with no exclusions.
The data sources created from connections to Elasticsearch data stores with any of these configurations function almost identically.
Known Issue Summary
The following known issues exist when the _source field is disabled or when it is enabled with exclusions:
- Raw data presentation will vary, depending on the source from which the raw field data is fetched. In particular, fused data sources may be affected where Elasticsearch indices with different mappings are joined (for example, when such indices are joined by an IP field and one of them allows Self-Service Analytics to fetch the data from the original documents but another requires Self-Service Analytics to fetch the data from doc values). See Raw Data Differences .
- The last value metric may be computed incorrectly for nested fields. Last value metrics are computed incorrectly when a time field is higher in the nested hierarchy or when a time field does not belong to the same hierarchy as the metric field.
- Raw data is not available for some nested fields in multi-index Elasticsearch data sources. When a nested field exists in some indices but is absent in other indices, the field’s raw data is not available. It is represented as having a NULL value in all documents when it is included in a table.
- Some nested fields are not searchable in multi-index data sources. When a nested field exists in some indices but is absent in other indices, it cannot be used in text search queries. Such fields will not be used for text searches.
Raw Data Differences
The following Self-Service Analytics functions are impacted by the source document storage configuration of your Elasticsearch data stores:
- The data source collection preview on the Indices tab of the data source configuration
- Tables
- Text search results
- Last value metric computations.
Self-Service Analytics fetches the raw value of a field (including its last value metric result) in the following order:
- If the field is stored, the stored value is fetched.
- If the field is available in the original stored document, the value in the original stored document is fetched.
- If doc values are available for the field and the field is not a text field, the doc value is fetched. For more information, see Text Field Raw Data Considerations.
Results vary based on the source from which the value was fetched, as described in the following table:
| Value Fetched From | Differences from the original stored document |
|---|
| The stored value |
- NULL values in arrays are excluded.
- Arrays may be sorted, completely or partially.
- Numeric values may be approximated.
- IPv6 addresses are normalized.
|
| The doc value |
- NULL values in arrays are excluded.
- Arrays may be sorted, completely or partially.
- Duplicates in
string (keyword) arrays are excluded, completely or partially.
- Numeric values may be approximated.
- IPv6 addresses are normalized.
|
Text Field Raw Data Considerations
Doc values are enabled by default for all fields, except for text fields. Consequently, by default, even if the original document is not stored or some fields are excluded from it, raw data is available for all fields, except for text fields.
An alternative structure called field data can be used for text fields. However, field data contains a set of terms for a text field, not its original value.
For this reason, raw data for a text field is not available if the text field is not stored in the index and cannot be fetched from the original document.
For example, the following mapping specifies that original documents should not be stored and declares two fields: name of type keyword and description of type text:
Raw data for the text field description is not available in the index. To make raw data available for this field, declare it stored, as shown below:
Tokenization in Elasticsearch
Keep in mind that Elasticsearch, by default, tokenizes or analyzes fields that are of type text. As a result, strings consisting of two or more words may become separate fields when connected to Self-Service Analytics (for example, city names like Las Vegas). To disable this process and ensure that a string field is not analyzed, specify its type as keyword:
To learn more about tokenization in Elasticsearch, see Get Trained Models API.
Support of X-Pack for Elasticsearch
Self-Service Analytics allows you to connect to your Elasticsearch cluster and data set secured by X-Pack.
X-Pack is an add-on offering for Elasticsearch 7 that aims at securing the data on your cluster, and is included in Elasticsearch 8. Learn more about X-Pack.
To connect to the Elasticsearch cluster, you need to create an Elasticsearch user and configure the access privileges for this user.
The access permissions for the Elasticsearch user determine the scope of the data available for querying by Self-Service Analytics users.
To work with Elasticsearch data, use X-Pack to grant the following minimal access privileges to the Elasticsearch user:
After the Elasticsearch user permissions are configured, you can proceed with connecting to a data source.
Added Libraries Required to Connect Using a Transport Protocol
Self-Service Analytics extracts specific libraries needed to support secured connections to Elasticsearch clusters over a transport protocol. The Self-Service Analytics Elasticsearch connector starts and works normally without these libraries, except when you want to use secured transport connections. To use secured transport connections, you must download and enable these libraries. If you attempt to establish a secured transport connection to an Elasticsearch cluster without the required libraries, an error will occur when you try to validate the connection.
To download and enable the transport-required libraries:
-
Download the required libraries to
/opt/zoomdata/lib/edc-elasticsearch-<x.x>/ for Linux, and for <install-path>/lib/edc-elasticsearch-<x.x>/ Windows, where <x.x> is the version of Elasticsearch.
The following table provides a list of the required libraries for each supported Elasticsearch version, with URLs:
For example:
-
Update the
loader.path property value in the appropriate Elasticsearch connector property file to point to the directory path containing all the libraries you downloaded or to a comma-separated list combining all library paths. For example:
or
See Connector Properties and Property Files to determine the correct Elasticsearch property file to use and where to save it.
In version 25.3 and earlier, use the path datasource.driver-config.jar-path.
insightsoftware discourages changing properties in the /opt/zoomdata/conf directory (Linux) or <install-path>/conf (Windows). Copy the files you want to change to the /etc/zoomdata directory (Linux) or <install-path>/conf-modify (Windows) and change them there. This will ensure that your changes are not overwritten when Self-Service Analytics is next upgraded.
Quickly determine what changes you have made to a properties file using diff in Linux. For example:
or
For Windows environments, use your preferred diff utility to compare the differences between your original and updated property files.
-
Restart the Elasticsearch connector microservice. For example:
or
Connection Via HTTP or Transport Protocol and Using SSL
You can connect to your Elasticsearch cluster using either HTTP or transport protocols. SSL is optional for the HTTP connection but is required for transport connections when connecting to an X-Pack secured Elasticsearch cluster.
Elasticsearch: What Are the Commonly Reported Issues?
Why am I unable to define a Group-by after creating a visual?
By default, the data within an Elasticsearch data source is stored as “text” fields. However, in order to set a group-by, the field needs to be set as type “attribute” or else it will not show up in the group-by section. Please check your fields to make sure that the appropriate fields you would like to group-by are set as “attribute” within your Elasticsearch data source.
Why do my data source fields only contain single words?
Every string field in Elasticsearch is analyzed by default. If your field is “analyzed”, this means that each individual word within your string is tokenized/indexed, so they will return as separate values. Thus, if you want Elasticsearch to respect the string and not return the string as individual entities, please make sure to set the field to be “not analyzed” within your Elasticsearch data set.