I have an index where I used the new Lucene feature of indexing on a specific field. In my mapping, I have the following:
When I request documents using the same sort order, matches come back extremely fast. For example, I am searching Reddit submissions with an API I created:
If you look at the metadata->elasticsearch->took value, this search completes in milliseconds.
However, if I sort in the opposite direction, the search time is in seconds (usually over 10):
From what I know about binary search, searching on a sorted array is a O(log N) operation. However, sorting in the opposite direction should also be nearly as fast. Is this a bug with Lucene's implementation of their index?