In Elasticsearch SQL using group by year(date-field) is slow, should I create a standalone year-of-date field when importing?

Hi all, the "year" function in group by is slow.
Here is the example:

"select year(docdate), sum(docamt) FROM indexA GROUP BY year(docdate)"
is much slower than
"select docdate_year, sum(docamt) FROM indexA GROUP BY docdate_year"

Should I create another "year field", "month field", "day field" for speed?
Are there any other approach to speed the date-function in the group by clause?

Creating separate fields for year, month, day will definitely be faster than the YEAR SQL function.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.