-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix multi-value sort for unsigned long * Add initial rest-api-spec tests * add more rest tests * fix * fix * Extend MultiValueMode with dedicated support of unsigned_long doc values * Add CHANGELOG.md, minor cleanups * Correct the license headers * Correct the @publicapi version * Replace SingletonSortedNumericUnsignedLongValues with LongToSortedNumericUnsignedLongValues (as per review comments) --------- (cherry picked from commit f6dc4a6) Signed-off-by: panguixin <[email protected]> Signed-off-by: Andriy Redko <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <[email protected]>
- Loading branch information
1 parent
da323e5
commit 2ed6c91
Showing
9 changed files
with
1,126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
rest-api-spec/src/main/resources/rest-api-spec/test/search/260_sort_double.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: double_sort | ||
body: | ||
settings: | ||
number_of_shards: 3 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
field: | ||
type: double | ||
|
||
--- | ||
"test sorting against double only fields": | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{ "index" : { "_index" : "double_sort", "_id" : "1" } }' | ||
- '{"field" : [ 900719925474099.1, 1.1 ] }' | ||
- '{ "index" : { "_index" : "double_sort", "_id" : "2" } }' | ||
- '{"field" : [ 900719925474099.2, 900719925474099.3 ] }' | ||
- '{ "index" : { "_index" : "double_sort", "_id" : "3" } }' | ||
- '{"field" : [ 450359962737049.4, 3.5, 4.6 ] }' | ||
- '{ "index" : { "_index" : "double_sort", "_id" : "4" } }' | ||
- '{"field" : [ 450359962737049.7, 5.8, -1.9, -2.0 ] }' | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [{ field: { mode: max, order: desc } } ] | ||
- match: {hits.total.value: 4 } | ||
- length: {hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.0.sort.0: 900719925474099.2 } | ||
- match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.1.sort.0: 900719925474099.1 } | ||
- match: { hits.hits.2._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.2.sort.0: 450359962737049.7 } | ||
- match: { hits.hits.3._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.3.sort.0: 450359962737049.4 } | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: max, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.0.sort.0: 450359962737049.4 } | ||
- match: { hits.hits.1._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.1.sort.0: 450359962737049.7 } | ||
- match: { hits.hits.2._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.2.sort.0: 900719925474099.1 } | ||
- match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.3.sort.0: 900719925474099.2 } | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: min, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.0.sort: [ -2.0 ] } | ||
- match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.1.sort.0: 1.1 } | ||
- match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.2.sort.0: 3.5 } | ||
- match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.3.sort.0: 900719925474099.2 } | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: median, order: desc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.0.sort.0: 900719925474099.2 } | ||
- match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.1.sort.0: 450359962737050.1 } | ||
- match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.2.sort.0: 4.6 } | ||
- match: { hits.hits.3._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.3.sort.0: 1.95 } | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: avg, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.0.sort.0: 112589990684262.89 } | ||
- match: { hits.hits.1._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.1.sort.0: 150119987579019.16 } | ||
- match: { hits.hits.2._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.2.sort.0: 450359962737050.1 } | ||
- match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.3.sort.0: 900719925474099.2 } | ||
|
||
- do: | ||
search: | ||
index: double_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: sum, order: desc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: double_sort } | ||
- match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } | ||
- match: { hits.hits.0.sort.0: 1801439850948198.5 } | ||
- match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } | ||
- match: { hits.hits.1.sort.0: 900719925474100.2 } | ||
- match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } | ||
- match: { hits.hits.2.sort.0: 450359962737057.5 } | ||
- match: { hits.hits.3._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } | ||
- match: { hits.hits.3.sort.0: 450359962737051.56 } |
137 changes: 137 additions & 0 deletions
137
rest-api-spec/src/main/resources/rest-api-spec/test/search/260_sort_long.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: long_sort | ||
body: | ||
settings: | ||
number_of_shards: 3 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
field: | ||
type: long | ||
|
||
--- | ||
"test sorting against long only fields": | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{ "index" : { "_index" : "long_sort", "_id" : "1" } }' | ||
- '{"field" : [ 9223372036854775807, 1 ] }' | ||
- '{ "index" : { "_index" : "long_sort", "_id" : "2" } }' | ||
- '{"field" : [ 922337203685477777, 2 ] }' | ||
- '{ "index" : { "_index" : "long_sort", "_id" : "3" } }' | ||
- '{"field" : [ 2147483647, 3, 4 ] }' | ||
- '{ "index" : { "_index" : "long_sort", "_id" : "4" } }' | ||
- '{"field" : [ 2147483648, 5, -1, -2 ] }' | ||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [{ field: { mode: max, order: desc } } ] | ||
- match: {hits.total.value: 4 } | ||
- length: {hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.0.sort.0: 9223372036854775807 } | ||
- match: { hits.hits.1._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.1.sort.0: 922337203685477777 } | ||
- match: { hits.hits.2._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.2.sort.0: 2147483648 } | ||
- match: { hits.hits.3._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.3.sort.0: 2147483647 } | ||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: max, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.0.sort.0: 2147483647 } | ||
- match: { hits.hits.1._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.1.sort.0: 2147483648 } | ||
- match: { hits.hits.2._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.2.sort.0: 922337203685477777 } | ||
- match: { hits.hits.3._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.3.sort.0: 9223372036854775807 } | ||
|
||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [{ field: { mode: min, order: desc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.0.sort.0: 3 } | ||
- match: { hits.hits.1._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.1.sort.0: 2 } | ||
- match: { hits.hits.2._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.2.sort.0: 1 } | ||
- match: { hits.hits.3._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.3.sort: [ -2 ] } | ||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: median, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.0.sort.0: 2 } | ||
- match: { hits.hits.1._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.1.sort.0: 4 } | ||
- match: { hits.hits.2._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.2.sort.0: 461168601842738880 } | ||
- match: { hits.hits.3._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.3.sort.0: 4611686018427387904 } | ||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: avg, order: desc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.0.sort.0: 461168601842738880 } | ||
- match: { hits.hits.1._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.1.sort.0: 715827885 } | ||
- match: { hits.hits.2._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.2.sort.0: 536870913 } | ||
- match: { hits.hits.3._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.3.sort: [ -4611686018427387904 ] } | ||
|
||
- do: | ||
search: | ||
index: long_sort | ||
body: | ||
size: 5 | ||
sort: [ { field: { mode: sum, order: asc } } ] | ||
- match: { hits.total.value: 4 } | ||
- length: { hits.hits: 4 } | ||
- match: { hits.hits.0._index: long_sort } | ||
- match: { hits.hits.0._source.field: [ 9223372036854775807, 1 ] } | ||
- match: { hits.hits.0.sort: [ -9223372036854775808 ] } | ||
- match: { hits.hits.1._source.field: [ 2147483648, 5, -1, -2 ] } | ||
- match: { hits.hits.1.sort.0: 2147483650 } | ||
- match: { hits.hits.2._source.field: [ 2147483647, 3, 4 ] } | ||
- match: { hits.hits.2.sort.0: 2147483654 } | ||
- match: { hits.hits.3._source.field: [ 922337203685477777, 2 ] } | ||
- match: { hits.hits.3.sort.0: 922337203685477779 } |
Oops, something went wrong.