From 6d667e5d41b51ba8a004374be811e2f185b35be7 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Wed, 4 Sep 2013 22:06:38 +0200 Subject: [PATCH] [DOCS] Missing sort values now works for all field types --- docs/reference/search/request/sort.asciidoc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/reference/search/request/sort.asciidoc b/docs/reference/search/request/sort.asciidoc index 61af55d1e696..a32261d4ce46 100644 --- a/docs/reference/search/request/sort.asciidoc +++ b/docs/reference/search/request/sort.asciidoc @@ -9,7 +9,7 @@ field name for `_score` to sort by score. -------------------------------------------------- { "sort" : [ - { "post_date" : {"order" : "asc"} }, + { "post_date" : {"order" : "asc"}}, "user", { "name" : "desc" }, { "age" : "desc" }, @@ -30,13 +30,13 @@ the response. Elasticsearch supports sorting by array or multi-valued fields. The `mode` option controls what array value is picked for sorting the document it belongs -to. The `mode` option can have the following values: +to. The `mode` option can have the following values: [horizontal] -`min`:: Pick the lowest value. +`min`:: Pick the lowest value. `max`:: Pick the highest value. `sum`:: Use the sum of all values as sort value. Only applicable for - number based array fields. + number based array fields. `avg`:: Use the average of all values as sort value. Only applicable for number based array fields. @@ -63,15 +63,15 @@ curl -XPOST 'localhost:9200/_search' -d '{ Elasticsearch also supports sorting by fields that are inside one or more nested objects. The sorting by nested field support has the following parameters on top of the already -existing sort options: +existing sort options: -`nested_path`:: +`nested_path`:: Defines the on what nested object to sort. The actual sort field must be a direct field inside this nested object. The default is to use the most immediate inherited nested object from the sort - field. + field. -`nested_filter`:: +`nested_filter`:: A filter the inner objects inside the nested path should match with in order for its field values to be taken into account by sorting. Common case is to repeat the query / filter inside the @@ -109,8 +109,9 @@ scripts and sorting by geo distance. ==== Missing Values -Numeric fields support specific handling for missing fields in a doc. -The `missing` value can be `_last`, `_first`, or a custom value (that +The `missing` parameter specifies how docs which are missing +the field should be treated: The `missing` value can be +set to `_last`, `_first`, or a custom value (that will be used for missing docs as the sort value). For example: [source,js]