Essql LIMIT selecting at random

I am making a horisontal bar chart, and I only need the top 10 results of my data set.

My code is as follows:
SELECT role_, COUNT(role_) as role_count FROM "*canvas" GROUP BY role_
ORDER BY role_count DESC

If I preview, it orders the output perfectly:
33

But when I add LIMIT 10 on my essql statement, it chooses 10 entries from the whole, and not the first 10:
444

I can't see any system in this, and using TOP 10 after SELECT gave an error.
Can someone please tell me what is going on with LIMIT? :slight_smile:

I think you are hitting this bug: https://github.com/elastic/elasticsearch/issues/40984.
What ES version are you testing this on?

I am using ES 6.8.

It sure looks like that issue - but I guess the solution has not been backported correctly thenif I'm still experiencing the bug?

@_Louw can you be a bit more precise on the version? The 6.8 branch has 4 releases.

Ah, this I did not know :slight_smile:

This is my version info:
"version" : {
"number" : "6.8.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_date" : "2019-05-15T20:06:13.172855Z",
"build_snapshot" : false,
"lucene_version" : "7.7.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
}

@_Louw sorry for the delay, got the chance to test 6.8.0 now and I realized this is a slightly different bug that was fixed in 6.8.1: https://github.com/elastic/elasticsearch/issues/42851 with https://github.com/elastic/elasticsearch/pull/43154.

Any chance you could test your query on 6.8.1 and see if it's still present? Thanks.
Again, sorry for the delay and the initial (wrong) assessment of the issue.

Yes, I got it tested on 6.8.3, and it works there - thank you!

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