I am using Shape field type to store multi-point 2D trajectory paths (LINESTRING). All coordinates are normalized to the range [0..1].
And it seems that query performance (say search for intersection with 2-point line) is quite slow - it looks like a hotspot in profiler. As an example: if I add Shape query which matches almost all objects filtered by other filter clauses, query time increases from 3-5ms to 50-450ms. And it looks like size does not affect the time - it can be 10 or 5000 - does not matter - seems like it checks every potentially suitable document.
Some context: Elastic 7.9.2, all clauses are filters of Bool query, query has sorting (the same as index order).
I suspect this is because of [0..1] scale, but I'm unable to find any details about it.
After I scaled coordinates to integer values request time become ~40% less.
Then I forcemerge index and it looks like shape query start using caching more aggressively - ES reports 2-5ms of search time. But profiler still shows that shape query is a bottleneck (~300ms).
Can long trajectory (tens of points) be a cause?