This documentation page assumes that you already have a SeekTable account. You can create free account by signing up.

Pivot table by ElasticSearch

Native ElasticSearch connector can be used for real-time reports (pivot tables, charts, datagrids) and ad-hoc queries without need to use Elastic Quert DSL directly. You may found that in many cases SeekTable can be a good alternative to Kibana; also it allows you to publish live web reports by ElasticSearch in a simple way.

  1. Click on "Connect to Database" item at "Cubes" view, or just open this link (ensure that you're logged in).
  2. Select "ElasticSearch" in Data Source Type selector: ElasticSearch connection settings
  3. Fill all required fields:
    Cube Name
    short title that describes this data source
    Connection URL
    Base URL of your ElasticSearch API endpoint, for example:
    https://ReadOnly:nxxr8qt7n26c7jwijhwg1ipnarf402yn@thorin-us-east-1.searchly.com
    Index
    the name of the index to query.
    Doc Type
    You might need to specify mapping type if you use legacy version of ElasitcSearch (5.x or earlier). For ElasticSearch 6.x no need to specify doc type option.
  4. Infer dimensions and measures by columns option: keep it checked to determine dimensions and measures by first N documents - in this case you don't need to define Dimensions and Measures by yourself. You can edit configuration later and remove excessive elements, or customize automatically determined ones.
  5. Click on "Save" button.

If everything is fine you should see a new cube dashboard with the list of available dimensions/measures. In case of connection error you'll see an orange box with the error message; don't forget to ensure that ElasticSearch API can be accessed by SeekTable server and it is not blocked by firewall.
If you specified "Infer dimensions and measures" option and get a cube with no dimensions most likely you've specified non-existing mapping type in "Doc Type".

Dimensions setup

ElasticSearch dimensions setup
Type
Field: dimension value is a document field or script field (script code should be provided as first "Parameter").
Expression: dimension is defined as calculated field with custom formula that uses another dimensions as arguments (formula and arguments should be specified in "Parameters").
Name
Unique dimension identifier. For Type=Field this is document or sub-document field specifier.
Label
User-friendly dimension title (optional).
Format
Custom format string (.NET String.Format) for dimension values (optional). Examples:
  • for number values: ${0:0.##} → $10.25
  • for date values: {0:yyyy-MM-dd} → 2017-05-25
Parameters
For Type=Field: you can specify custom script field with "painless" expression syntax. For example:
(doc["registered"].empty ? null : doc["registered"].date.year)
(extracts year value from "registered" date field). Also you can specify "number" for 2-nd parameter if script result is a number (this affects sorting in flat table reports).
For Type=Expression: you can specify custom formula (1-st parameter) and dimension names for the arguments (2-nd, 3-rd etc parameter).

Measures setup

ElasticSearch measures setup
Type
Count: the number of aggregated documents.
Sum: the total sum of a numeric field.
Average: the average value of a numeric field.
Min: the minimal value of a column.
Max: the maximum value of a column.
FirstValue: custom acummulator aggregation pipeline expression.
Expression: measure defined as calculated field.
Name
Explicit unique measure identifier. You can leave it blank (for any measure types except "Expression") to generate the name automatically.
Label
User-friendly measure caption (optional).
Format
Custom format string (.NET String.Format) for measure values (optional). Example:
  • ${0:0.##} → $10.25
Parameters
For Type=Count: no parameters needed.
For Type=Sum/Average/Min/Max: document field or field path to aggregate.
For Type=Expression: first parameter is formula expression, and next parameters are names of measures used as arguments in the expression.

Troubleshooting

ERROR: Fielddata is disabled on text fields by default. Set fielddata=true on [some_text_field] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.

This error appears when you try to aggregate by text field and your ElasticSearch index doesn't have original values for this field. In most cases you can use .keyword suffix and enable unindexed values for aggregation as described in official ElasticSearch documentation.