diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/280_unsigned_long.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/280_unsigned_long.yml new file mode 100644 index 0000000000000..4dafae31f23aa --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/280_unsigned_long.yml @@ -0,0 +1,61 @@ +setup: + - do: + indices.create: + index: unsigned_long_sort + body: + settings: + number_of_shards: 3 + number_of_replicas: 0 + mappings: + properties: + field: + type: unsigned_long + +--- +"test sorting against unsigned_long only fields": + - skip: + version: " - 2.19.99" + reason: "this change is added in 3.0.0" + + - do: + bulk: + refresh: true + body: + - '{ "index" : { "_index" : "unsigned_long_sort", "_id" : "1" } }' + - '{"field" : [ 13835058055282163712, 1 ] }' + - '{ "index" : { "_index" : "unsigned_long_sort", "_id" : "2" } }' + - '{"field" : [ 13835058055282163713, 2 ] }' + - '{ "index" : { "_index" : "unsigned_long_sort", "_id" : "3" } }' + - '{"field" : [ 13835058055282163714, 3 ] }' + + - do: + search: + index: unsigned_long_sort + body: + size: 5 + sort: [{ field: { mode: max, order: desc } } ] + - match: {hits.total.value: 3 } + - length: {hits.hits: 3 } + - match: { hits.hits.0._index: unsigned_long_sort } + - match: { hits.hits.0._source.field: [ 13835058055282163714, 3 ] } + - match: { hits.hits.0.sort: [ 13835058055282163714 ] } + - match: { hits.hits.1._source.field: [ 13835058055282163713, 2 ] } + - match: { hits.hits.1.sort: [ 13835058055282163713 ] } + - match: { hits.hits.2._source.field: [ 13835058055282163712, 1 ] } + - match: { hits.hits.2.sort: [ 13835058055282163712 ] } + + - do: + search: + index: unsigned_long_sort + body: + size: 5 + sort: [{ field: { mode: max, order: asc } } ] + - match: {hits.total.value: 3 } + - length: {hits.hits: 3 } + - match: { hits.hits.0._index: unsigned_long_sort } + - match: { hits.hits.0._source.field: [ 13835058055282163712, 1 ] } + - match: { hits.hits.0.sort: [ 13835058055282163712 ] } + - match: { hits.hits.1._source.field: [ 13835058055282163713, 2 ] } + - match: { hits.hits.1.sort: [ 13835058055282163713 ] } + - match: { hits.hits.2._source.field: [ 13835058055282163714, 3 ] } + - match: { hits.hits.2.sort: [ 13835058055282163714 ] } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/290_long.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/290_long.yml new file mode 100644 index 0000000000000..49e79cce88fce --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/290_long.yml @@ -0,0 +1,74 @@ +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" : [ 55282163712, 1 ] }' + - '{ "index" : { "_index" : "long_sort", "_id" : "2" } }' + - '{"field" : [ 55282163713, 2 ] }' + - '{ "index" : { "_index" : "long_sort", "_id" : "3" } }' + - '{"field" : [ 55282163714, 3 ] }' + + - do: + search: + index: long_sort + body: + size: 5 + sort: [{ field: { mode: max, order: desc } } ] + - match: {hits.total.value: 3 } + - length: {hits.hits: 3 } + - match: { hits.hits.0._index: long_sort } + - match: { hits.hits.0._source.field: [ 55282163714, 3 ] } + - match: { hits.hits.0.sort: [ 55282163714 ] } + - match: { hits.hits.1._source.field: [ 55282163713, 2 ] } + - match: { hits.hits.1.sort: [ 55282163713 ] } + - match: { hits.hits.2._source.field: [ 55282163712, 1 ] } + - match: { hits.hits.2.sort: [ 55282163712 ] } + + - do: + search: + index: long_sort + body: + size: 5 + sort: [{ field: { mode: min, order: desc } } ] + - match: {hits.total.value: 3 } + - length: {hits.hits: 3 } + - match: { hits.hits.0._index: long_sort } + - match: { hits.hits.0._source.field: [ 55282163714, 3 ] } + - match: { hits.hits.0.sort: [ 3 ] } + - match: { hits.hits.1._source.field: [ 55282163713, 2 ] } + - match: { hits.hits.1.sort: [ 2 ] } + - match: { hits.hits.2._source.field: [ 55282163712, 1 ] } + - match: { hits.hits.2.sort: [ 1 ] } + + - do: + search: + index: long_sort + body: + size: 5 + sort: [{ field: { mode: max, order: asc } } ] + - match: {hits.total.value: 3 } + - length: {hits.hits: 3 } + - match: { hits.hits.0._index: long_sort } + - match: { hits.hits.0._source.field: [ 55282163712, 1 ] } + - match: { hits.hits.0.sort: [ 55282163712 ] } + - match: { hits.hits.1._source.field: [ 55282163713, 2 ] } + - match: { hits.hits.1.sort: [ 55282163713 ] } + - match: { hits.hits.2._source.field: [ 55282163714, 3 ] } + - match: { hits.hits.2.sort: [ 55282163714 ] }