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
Add sorting support for fields that have multiple values per document (For example: string array or double array).
By default when sorting on a multi-valued field the lowest or highest value will be picked from the field values depending on the sort order.
It is possible to define what value should be picked when a document has multiple values in a field via the sort_mode option. The following options can be specified:
min - Pick the lowest value.
max - Pick the highest value.
sum - Use the sum of all values as sort value.
avg - Use the average of all values as sort value.
In the above example the field price has multiple prices per document. In this case the result hits will be sort by price ascending based on the average price per document.
The text was updated successfully, but these errors were encountered:
…the sort field is multi-valued.
The `min` and `max` sort modes are supported for all field types. Either the lowest value or the highest value is picked. In addition to that number based fields also support `sum` and `avg` as sort mode. If `sum` sort mode is used then all the values for a field and belonging to a document are added together and the result of that is used as sort value. If the `avg` sort mode is used then the average of all values for the sort field belonging to that document is used as sort value.
Relates to elastic#2634
…the sort field is multi-valued.
The `min` and `max` sort modes are supported for all field types. Either the lowest value or the highest value is picked. In addition to that number based fields also support `sum` and `avg` as sort mode. If `sum` sort mode is used then all the values for a field and belonging to a document are added together and the result of that is used as sort value. If the `avg` sort mode is used then the average of all values for the sort field belonging to that document is used as sort value.
Relates to #2634
Add sorting support for fields that have multiple values per document (For example: string array or double array).
By default when sorting on a multi-valued field the lowest or highest value will be picked from the field values depending on the sort order.
It is possible to define what value should be picked when a document has multiple values in a field via the
sort_mode
option. The following options can be specified:min
- Pick the lowest value.max
- Pick the highest value.sum
- Use the sum of all values as sort value.avg
- Use the average of all values as sort value.Example usage
In the above example the field price has multiple prices per document. In this case the result hits will be sort by price ascending based on the average price per document.
The text was updated successfully, but these errors were encountered: