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
Copy file name to clipboardExpand all lines: docs/reference/elasticsearch/index-settings/sorting.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,16 +80,20 @@ $$$index-sort-order$$$
80
80
`index.sort.order` {applies_to}`serverless: all`
81
81
: The sort order to use for each field. The order option can have the following values:
82
82
83
-
* `asc`: For ascending order
83
+
* `asc`: For ascending order.
84
84
* `desc`: For descending order.
85
85
86
+
When `index.sort.field` is set but `index.sort.order` is not explicitly provided, each field defaults to `asc`.
87
+
86
88
$$$index-sort-mode$$$
87
89
`index.sort.mode` {applies_to}`serverless: all`
88
90
: Elasticsearch supports sorting by multi-valued fields. The mode option controls what value is picked to sort the document. The mode option can have the following values:
89
91
90
92
* `min`: Pick the lowest value.
91
93
* `max`: Pick the highest value.
92
94
95
+
When `index.sort.order` is set to `asc`, `index.sort.mode` defaults to `min`. If you set the order to `desc`, the mode defaults to `max`.
* `_last`: Documents without value for the field are sorted last.
99
103
* `_first`: Documents without value for the field are sorted first.
100
104
105
+
Documents missing the sort field are always sorted last by default, regardless of sort order.
106
+
101
107
102
108
::::{warning}
103
109
Index sorting can be defined only once at index creation. It is not allowed to add or update a sort on an existing index. Index sorting also has a cost in terms of indexing throughput since documents must be sorted at flush and merge time. You should test the impact on your application before activating this feature.
0 commit comments