OpenSearch/buildSrc
Mayya Sharipova 7cf170830c
Optimize sort on numeric long and date fields. (#49732)
This rewrites long sort as a `DistanceFeatureQuery`, which can
efficiently skip non-competitive blocks and segments of documents.
Depending on the dataset, the speedups can be 2 - 10 times.

The optimization can be disabled with setting the system property
`es.search.rewrite_sort` to `false`.

Optimization is skipped when an index has 50% or more data with
the same value.

Optimization is done through:
1. Rewriting sort as `DistanceFeatureQuery` which can
efficiently skip non-competitive blocks and segments of documents.

2. Sorting segments according to the primary numeric sort field(#44021)
This allows to skip non-competitive segments.

3. Using collector manager.
When we optimize sort, we sort segments by their min/max value.
As a collector expects to have segments in order,
we can not use a single collector for sorted segments.
We use collectorManager, where for every segment a dedicated collector
will be created.

4. Using Lucene's shared TopFieldCollector manager
This collector manager is able to exchange minimum competitive
score between collectors, which allows us to efficiently skip
the whole segments that don't contain competitive scores.

5. When index is force merged to a single segment, #48533 interleaving
old and new segments allows for this optimization as well,
as blocks with non-competitive docs can be skipped.

Backport for #48804


Co-authored-by: Jim Ferenczi <jim.ferenczi@elastic.co>
2019-11-29 15:37:40 -05:00
..
reaper Apply 2-space indent to all gradle scripts (#49071) 2019-11-14 11:01:23 +00:00
src Optimize sort on numeric long and date fields. (#49732) 2019-11-29 15:37:40 -05:00
.gitignore
build.gradle Run build-tools test with Gradle jdk (#49459) (#49497) 2019-11-22 11:59:46 -07:00
settings.gradle Remove empty buildSrc subproject (#47415) 2019-10-01 16:34:31 -07:00
version.properties [7.x] Update opensaml dependency (#44972) (#49512) 2019-11-29 00:17:16 +02:00