elasticsearch/test
Mayya Sharipova 080a0cdd89
Enable sort optimization on int, short and byte fields (#127968)
Before this PR sorting on integer, short and byte fields types used
SortField.Type.LONG. This made sort optimization impossible for these
field types.

This PR uses SortField.Type.INT for integer, short and byte fields. This
enables sort optimization.

There are several caveats with changing sort type that are addressed: -
Before mixed sort on integer and long fields was automatically
supported, as both field types used SortField.TYPE.LONG. Now when
merging results from different shards, we need to convert sort to LONG
and results to long values. - Similar for collapsing when there is mixed
INT and LONG sort types. - Index sorting. Similarly, before for index
sorting on integer field, SortField.Type.LONG was used. This sort type
is stored in the index writer config on disk and can't be modified. Now
when providing sortField() for index sorting, we need to account for
index version: for older indices return sort with SortField.Type.LONG
and for new indices return SortField.Type.INT.

---

There is only 1 change that  may be considered not backwards compatible:
Before if an integer field was [missing a
value](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/sort-search-results#_missing_values)
, it sort values will return Long.MAX_VALUE in a search response. With
this integer, it sort valeu will return Integer.MAX_VALUE.  But I think
this change is ok, as in our documentation, we don't provide information
what value will be returned, we just say it will be sorted last. 

---

Also closes #127965 (as same type validation in added for collapse
queries)
2025-06-03 07:50:11 +10:00
..
external-modules Make repositories project aware (#128285) 2025-05-28 17:29:39 +10:00
fixtures Upgrade MinIO test container (#128424) 2025-05-27 07:24:41 +01:00
framework Enable sort optimization on int, short and byte fields (#127968) 2025-06-03 07:50:11 +10:00
immutable-collections-patch Update ASM 9.7 -> 9.7.1 to support JDK 24 (#118094) 2024-12-06 08:16:46 +01:00
logger-usage Update ASM 9.7 -> 9.7.1 to support JDK 24 (#118094) 2024-12-06 08:16:46 +01:00
metadata-extractor Remove historical features infrastructure (#117043) 2024-11-24 19:39:09 +00:00
test-clusters This adds a new experimental IVF format behind a feature flag (#128631) 2025-05-30 16:20:23 -04:00
x-content Use directory name as project name for libs (#115720) 2024-10-29 13:02:28 -07:00
yaml-rest-runner Avoiding infinite loop for invalid files in rest spec parser (#128335) 2025-05-22 15:27:33 -05:00
build.gradle Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07:00