Why term query, keyword is faster than number

I saw in Tune for search speed | Elasticsearch Reference [7.11] | Elastic, in term query, keyword query The speed is faster than the digital type, but I am not sure what the reason is. Is there any blog or document that explains this? What I have always understood before is that numeric queries are always faster than strings

An exact query on a numeric value is turned into a range query eg from 274637 to 274637.
The underlying data structure is optimised for retrieving blocks of values covered by a ranges rather than individual unique values.

You can test the effects yourself with this test rig
I found the speed difference wasn’t noticeable as part of all the other things a search does until the query had many terms. Then the overhead becomes apparent and with 100 terms I was seeing four times slower responses.

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