|
1 |
| -setup: |
| 1 | +"search with search_after parameter": |
2 | 2 | - do:
|
3 | 3 | indices.create:
|
4 | 4 | index: test
|
|
24 | 24 | indices.refresh:
|
25 | 25 | index: test
|
26 | 26 |
|
27 |
| ---- |
28 |
| -"search with search_after parameter": |
29 |
| - |
30 | 27 | - do:
|
31 | 28 | search:
|
32 | 29 | rest_total_hits_as_int: true
|
@@ -94,3 +91,130 @@ setup:
|
94 | 91 |
|
95 | 92 | - match: {hits.total: 3}
|
96 | 93 | - length: {hits.hits: 0 }
|
| 94 | + |
| 95 | +--- |
| 96 | +"date": |
| 97 | + - do: |
| 98 | + indices.create: |
| 99 | + index: test |
| 100 | + body: |
| 101 | + mappings: |
| 102 | + properties: |
| 103 | + timestamp: |
| 104 | + type: date |
| 105 | + format: yyyy-MM-dd HH:mm:ss.SSS |
| 106 | + - do: |
| 107 | + bulk: |
| 108 | + refresh: true |
| 109 | + index: test |
| 110 | + body: | |
| 111 | + {"index":{}} |
| 112 | + {"timestamp":"2019-10-21 00:30:04.828"} |
| 113 | + {"index":{}} |
| 114 | + {"timestamp":"2019-10-21 08:30:04.828"} |
| 115 | +
|
| 116 | + - do: |
| 117 | + search: |
| 118 | + index: test |
| 119 | + body: |
| 120 | + size: 1 |
| 121 | + sort: [{ timestamp: desc }] |
| 122 | + - match: {hits.total.value: 2 } |
| 123 | + - length: {hits.hits: 1 } |
| 124 | + - match: {hits.hits.0._index: test } |
| 125 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 08:30:04.828" } |
| 126 | + - match: {hits.hits.0.sort: [1571646604828] } |
| 127 | + |
| 128 | + # search_after with the sort |
| 129 | + - do: |
| 130 | + search: |
| 131 | + index: test |
| 132 | + body: |
| 133 | + size: 1 |
| 134 | + sort: [{ timestamp: desc }] |
| 135 | + search_after: [1571646604828] |
| 136 | + - match: {hits.total.value: 2 } |
| 137 | + - length: {hits.hits: 1 } |
| 138 | + - match: {hits.hits.0._index: test } |
| 139 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 00:30:04.828" } |
| 140 | + - match: {hits.hits.0.sort: [1571617804828] } |
| 141 | + |
| 142 | + # search_after with the formatted date |
| 143 | + - do: |
| 144 | + search: |
| 145 | + index: test |
| 146 | + body: |
| 147 | + size: 1 |
| 148 | + sort: [{ timestamp: desc }] |
| 149 | + search_after: ["2019-10-21 08:30:04.828"] |
| 150 | + - match: {hits.total.value: 2 } |
| 151 | + - length: {hits.hits: 1 } |
| 152 | + - match: {hits.hits.0._index: test } |
| 153 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 00:30:04.828" } |
| 154 | + - match: {hits.hits.0.sort: [1571617804828] } |
| 155 | + |
| 156 | +--- |
| 157 | +"date_nanos": |
| 158 | + - skip: |
| 159 | + version: " - 7.99.99" |
| 160 | + reason: fixed in 8.0.0 to be backported to 7.10.0 |
| 161 | + |
| 162 | + - do: |
| 163 | + indices.create: |
| 164 | + index: test |
| 165 | + body: |
| 166 | + mappings: |
| 167 | + properties: |
| 168 | + timestamp: |
| 169 | + type: date_nanos |
| 170 | + format: yyyy-MM-dd HH:mm:ss.SSSSSS |
| 171 | + - do: |
| 172 | + bulk: |
| 173 | + refresh: true |
| 174 | + index: test |
| 175 | + body: | |
| 176 | + {"index":{}} |
| 177 | + {"timestamp":"2019-10-21 00:30:04.828740"} |
| 178 | + {"index":{}} |
| 179 | + {"timestamp":"2019-10-21 08:30:04.828733"} |
| 180 | +
|
| 181 | + - do: |
| 182 | + search: |
| 183 | + index: test |
| 184 | + body: |
| 185 | + size: 1 |
| 186 | + sort: [{ timestamp: desc }] |
| 187 | + - match: {hits.total.value: 2 } |
| 188 | + - length: {hits.hits: 1 } |
| 189 | + - match: {hits.hits.0._index: test } |
| 190 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 08:30:04.828733" } |
| 191 | + - match: {hits.hits.0.sort: [1571646604828733000] } |
| 192 | + |
| 193 | + # search_after with the sort |
| 194 | + - do: |
| 195 | + search: |
| 196 | + index: test |
| 197 | + body: |
| 198 | + size: 1 |
| 199 | + sort: [{ timestamp: desc }] |
| 200 | + search_after: [1571646604828733000] |
| 201 | + - match: {hits.total.value: 2 } |
| 202 | + - length: {hits.hits: 1 } |
| 203 | + - match: {hits.hits.0._index: test } |
| 204 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 00:30:04.828740" } |
| 205 | + - match: {hits.hits.0.sort: [1571617804828740000] } |
| 206 | + |
| 207 | + # search_after with the formatted date |
| 208 | + - do: |
| 209 | + search: |
| 210 | + index: test |
| 211 | + body: |
| 212 | + size: 1 |
| 213 | + sort: [{ timestamp: desc }] |
| 214 | + search_after: ["2019-10-21 08:30:04.828733"] |
| 215 | + - match: {hits.total.value: 2 } |
| 216 | + - length: {hits.hits: 1 } |
| 217 | + - match: {hits.hits.0._index: test } |
| 218 | + - match: {hits.hits.0._source.timestamp: "2019-10-21 00:30:04.828740" } |
| 219 | + - match: {hits.hits.0.sort: [1571617804828740000] } |
| 220 | + |
0 commit comments