cube-js / cube-js/cube

Time range does not work with AWS ES (open distro)

Open
#3,129 3 comments 0 reactions 0 assignees View on GitHub
driver:elasticsearch help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
Time range does not work with AWS ES

**To Reproduce**
Steps to reproduce the behavior:
1. Create a valid cube schema connected to AWS ES 7.7
2. Build a query with time range set to anything other than all time.
3. Run the query
4. See error

**Expected behavior**
Generate SQL should use a date function compatible with AWS ES as documented https://opendistro.github.io/for-elasticsearch-docs/docs/sql/functions/

Currently it uses DATE_TRUNC which is not supported by open distro ES.

**Screenshots**
Screen Shot 2021-07-19 at 4 28 41 PM

`
Error: "{\n \"error\": {\n \"reason\": \"Invalid SQL query\",\n \"details\": \"Failed to parse query due to offending symbol [:] at: 'SELECT\\n DATE_TRUNC('day', d_n_s_activity_red.timestamp:' <--- HERE... More details: Expecting tokens in {'SELECT', '('}\",\n \"type\": \"SyntaxAnalysisException\"\n },\n \"status\": 400\n}"
`

**Version:**
v0.27.53
AWS ES 7.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.