opendistro-for-elasticsearch / sql

🔍 Open Distro SQL Plugin
https://opendistro.github.io/for-elasticsearch/features/SQL%20Support.html
Apache License 2.0
621 stars 186 forks source link

Query with multiple indices, fall back to old SQL engine #1124

Open bhapin opened 3 years ago

bhapin commented 3 years ago

Version 1.13.2.0

Executing the following query is falling back to old SQL engine.

SELECT ifnull(field1,'null') AS Type, ifnull(field2,'null') AS Id, COUNT(*) AS cnt FROM index-2021-06-29-00,index-2021-06-29-01,index-2021-06-29-02,index-2021-06-29-03 WHERE field3 = 'value1' AND field4 = 'value2' GROUP BY Id,Type ORDER BY cnt DESC LIMIT 5000

Above query contains the GROUP BY on multiple columns. As the old SQL engine restrict the size to 10 for 2nd to nth aggregation, I need the query to hit the new SQL engine.

Indices are created on hourly basis and user can select timestamp range from 1 hour to 24 hours. Thus query will have from 1 to 24 indices.

Same query with single index is working fine (hitting new engine)

SELECT ifnull(field1,'null') AS Type, ifnull(field2,'null') AS Id, COUNT(*) AS cnt FROM index-2021-06-29-00 WHERE field3 = 'value1' AND field4 = 'value2' GROUP BY Id,Type ORDER BY cnt DESC LIMIT 5000

Is this the limitation in new SQL engine? Is the implementation of multiple indices is in pipeline for the upcoming version?

Thank in advance

FreCap commented 3 years ago

Hi @bhapin , if it falls back it means that currently there is something in your query that is not supported by the new engine. In the logs, you will find a more detailed explanation of why it failed.

As per "if it will be implemented in the future", I hope so! :D