|
| 1 | +setup: |
| 2 | + - do: |
| 3 | + indices.create: |
| 4 | + index: double_sort |
| 5 | + body: |
| 6 | + settings: |
| 7 | + number_of_shards: 3 |
| 8 | + number_of_replicas: 0 |
| 9 | + mappings: |
| 10 | + properties: |
| 11 | + field: |
| 12 | + type: double |
| 13 | + |
| 14 | +--- |
| 15 | +"test sorting against double only fields": |
| 16 | + |
| 17 | + - do: |
| 18 | + bulk: |
| 19 | + refresh: true |
| 20 | + body: |
| 21 | + - '{ "index" : { "_index" : "double_sort", "_id" : "1" } }' |
| 22 | + - '{"field" : [ 900719925474099.1, 1.1 ] }' |
| 23 | + - '{ "index" : { "_index" : "double_sort", "_id" : "2" } }' |
| 24 | + - '{"field" : [ 900719925474099.2, 900719925474099.3 ] }' |
| 25 | + - '{ "index" : { "_index" : "double_sort", "_id" : "3" } }' |
| 26 | + - '{"field" : [ 450359962737049.4, 3.5, 4.6 ] }' |
| 27 | + - '{ "index" : { "_index" : "double_sort", "_id" : "4" } }' |
| 28 | + - '{"field" : [ 450359962737049.7, 5.8, -1.9, -2.0 ] }' |
| 29 | + |
| 30 | + - do: |
| 31 | + search: |
| 32 | + index: double_sort |
| 33 | + body: |
| 34 | + size: 5 |
| 35 | + sort: [{ field: { mode: max, order: desc } } ] |
| 36 | + - match: {hits.total.value: 4 } |
| 37 | + - length: {hits.hits: 4 } |
| 38 | + - match: { hits.hits.0._index: double_sort } |
| 39 | + - match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 40 | + - match: { hits.hits.0.sort.0: 900719925474099.2 } |
| 41 | + - match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } |
| 42 | + - match: { hits.hits.1.sort.0: 900719925474099.1 } |
| 43 | + - match: { hits.hits.2._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 44 | + - match: { hits.hits.2.sort.0: 450359962737049.7 } |
| 45 | + - match: { hits.hits.3._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 46 | + - match: { hits.hits.3.sort.0: 450359962737049.4 } |
| 47 | + |
| 48 | + - do: |
| 49 | + search: |
| 50 | + index: double_sort |
| 51 | + body: |
| 52 | + size: 5 |
| 53 | + sort: [ { field: { mode: max, order: asc } } ] |
| 54 | + - match: { hits.total.value: 4 } |
| 55 | + - length: { hits.hits: 4 } |
| 56 | + - match: { hits.hits.0._index: double_sort } |
| 57 | + - match: { hits.hits.0._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 58 | + - match: { hits.hits.0.sort.0: 450359962737049.4 } |
| 59 | + - match: { hits.hits.1._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 60 | + - match: { hits.hits.1.sort.0: 450359962737049.7 } |
| 61 | + - match: { hits.hits.2._source.field: [ 900719925474099.1, 1.1 ] } |
| 62 | + - match: { hits.hits.2.sort.0: 900719925474099.1 } |
| 63 | + - match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 64 | + - match: { hits.hits.3.sort.0: 900719925474099.2 } |
| 65 | + |
| 66 | + - do: |
| 67 | + search: |
| 68 | + index: double_sort |
| 69 | + body: |
| 70 | + size: 5 |
| 71 | + sort: [ { field: { mode: min, order: asc } } ] |
| 72 | + - match: { hits.total.value: 4 } |
| 73 | + - length: { hits.hits: 4 } |
| 74 | + - match: { hits.hits.0._index: double_sort } |
| 75 | + - match: { hits.hits.0._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 76 | + - match: { hits.hits.0.sort: [ -2.0 ] } |
| 77 | + - match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } |
| 78 | + - match: { hits.hits.1.sort.0: 1.1 } |
| 79 | + - match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 80 | + - match: { hits.hits.2.sort.0: 3.5 } |
| 81 | + - match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 82 | + - match: { hits.hits.3.sort.0: 900719925474099.2 } |
| 83 | + |
| 84 | + - do: |
| 85 | + search: |
| 86 | + index: double_sort |
| 87 | + body: |
| 88 | + size: 5 |
| 89 | + sort: [ { field: { mode: median, order: desc } } ] |
| 90 | + - match: { hits.total.value: 4 } |
| 91 | + - length: { hits.hits: 4 } |
| 92 | + - match: { hits.hits.0._index: double_sort } |
| 93 | + - match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 94 | + - match: { hits.hits.0.sort.0: 900719925474099.2 } |
| 95 | + - match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } |
| 96 | + - match: { hits.hits.1.sort.0: 450359962737050.1 } |
| 97 | + - match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 98 | + - match: { hits.hits.2.sort.0: 4.6 } |
| 99 | + - match: { hits.hits.3._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 100 | + - match: { hits.hits.3.sort.0: 1.95 } |
| 101 | + |
| 102 | + - do: |
| 103 | + search: |
| 104 | + index: double_sort |
| 105 | + body: |
| 106 | + size: 5 |
| 107 | + sort: [ { field: { mode: avg, order: asc } } ] |
| 108 | + - match: { hits.total.value: 4 } |
| 109 | + - length: { hits.hits: 4 } |
| 110 | + - match: { hits.hits.0._index: double_sort } |
| 111 | + - match: { hits.hits.0._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 112 | + - match: { hits.hits.0.sort.0: 112589990684262.89 } |
| 113 | + - match: { hits.hits.1._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 114 | + - match: { hits.hits.1.sort.0: 150119987579019.16 } |
| 115 | + - match: { hits.hits.2._source.field: [ 900719925474099.1, 1.1 ] } |
| 116 | + - match: { hits.hits.2.sort.0: 450359962737050.1 } |
| 117 | + - match: { hits.hits.3._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 118 | + - match: { hits.hits.3.sort.0: 900719925474099.2 } |
| 119 | + |
| 120 | + - do: |
| 121 | + search: |
| 122 | + index: double_sort |
| 123 | + body: |
| 124 | + size: 5 |
| 125 | + sort: [ { field: { mode: sum, order: desc } } ] |
| 126 | + - match: { hits.total.value: 4 } |
| 127 | + - length: { hits.hits: 4 } |
| 128 | + - match: { hits.hits.0._index: double_sort } |
| 129 | + - match: { hits.hits.0._source.field: [ 900719925474099.2, 900719925474099.2 ] } |
| 130 | + - match: { hits.hits.0.sort.0: 1801439850948198.5 } |
| 131 | + - match: { hits.hits.1._source.field: [ 900719925474099.1, 1.1 ] } |
| 132 | + - match: { hits.hits.1.sort.0: 900719925474100.2 } |
| 133 | + - match: { hits.hits.2._source.field: [ 450359962737049.4, 3.5, 4.6 ] } |
| 134 | + - match: { hits.hits.2.sort.0: 450359962737057.5 } |
| 135 | + - match: { hits.hits.3._source.field: [ 450359962737049.7, 5.8, -1.9, -2.0 ] } |
| 136 | + - match: { hits.hits.3.sort.0: 450359962737051.56 } |
0 commit comments