What counts as a "long string" which would be worthwhile to index via a "hash" instead of via "exact"

Just reading up on indexing and I am not sure exactly when I should use a “hash” over “exact” for a eq based search. Should I ever use exact? Documentation says I should use “hash” with a long string which is a little ambiguous. Would a timezone be a long enough string?

Example: ‘Australia/Sydney’

Also your search tutorial example uses “term” and “exact” as indexes but your documentation indicates you should not do this? Is the documentation correct? Or am I missing something.

As a rule of thumb, I would recommend to always use hash. The hash size used is 8 bytes, so anything smaller than ~8 chars should be ok to use as exact (or hash - there wouldn’t be much performance difference). For anything significantly larger than 8 chars, hash has much better performance.

As for the tour, - you’re right - there’s no need to have exact there, since the term index allows eq. I’ll get that changed. Thanks!

2 Likes

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