You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
: Whether the field value should be stored and retrievable separately from the [`_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md) field. Accepts `true` or `false` (default).
217
217
218
+
## Sorting
219
+
220
+
Sorting is not supported for any of the `range` field types. Attempting to sort by a field of type range_field will result in a `400 Bad Request` response.
221
+
For example, executing a sort query on a field of type `integer_range`,
222
+
```console
223
+
PUT idx
224
+
{
225
+
"mappings": {
226
+
"properties": {
227
+
"my_range": {
228
+
"type": "integer_range"
229
+
}
230
+
}
231
+
}
232
+
}
233
+
234
+
POST idx/_search
235
+
{
236
+
"sort": [
237
+
{
238
+
"my_range": {
239
+
"order": "asc"
240
+
}
241
+
}
242
+
]
243
+
}
244
+
```
245
+
results in the following response:
246
+
```console-result
247
+
{
248
+
"error": {
249
+
"root_cause": [
250
+
{
251
+
"type": "illegal_argument_exception",
252
+
"reason": "Sorting by range field [my_range] is not supported"
253
+
}
254
+
],
255
+
"type": "search_phase_execution_exception",
256
+
"reason": "all shards failed",
257
+
"phase": "query",
258
+
"grouped": true,
259
+
"failed_shards": [
260
+
{
261
+
"shard": 0,
262
+
"index": "idx",
263
+
"node": "7pzVSCf5TuSNZYj-N7u3tw",
264
+
"reason": {
265
+
"type": "illegal_argument_exception",
266
+
"reason": "Sorting by range field [my_range] is not supported"
267
+
}
268
+
}
269
+
],
270
+
"caused_by": {
271
+
"type": "illegal_argument_exception",
272
+
"reason": "Sorting by range field [my_range] is not supported",
273
+
"caused_by": {
274
+
"type": "illegal_argument_exception",
275
+
"reason": "Sorting by range field [my_range] is not supported"
0 commit comments