From 7b878b5b5c67e5684dd58e398dc0a30f4bfbd241 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Mon, 24 Aug 2015 15:37:30 +0200 Subject: [PATCH] Docs: Document the `_doc` sort order. --- docs/reference/search/request/sort.asciidoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/reference/search/request/sort.asciidoc b/docs/reference/search/request/sort.asciidoc index 0a8f3682b72..1cc07e21313 100644 --- a/docs/reference/search/request/sort.asciidoc +++ b/docs/reference/search/request/sort.asciidoc @@ -3,7 +3,7 @@ Allows to add one or more sort on specific fields. Each sort can be reversed as well. The sort is defined on a per field level, with special -field name for `_score` to sort by score. +field name for `_score` to sort by score, and `_doc` to sort by index order. [source,js] -------------------------------------------------- @@ -21,6 +21,10 @@ field name for `_score` to sort by score. } -------------------------------------------------- +NOTE: `_doc` has no real use-case besides being the most efficient sort order. +So if you don't care about the order in which documents are returned, then you +should sort by `_doc`. This especially helps when <>. + ==== Sort Values The sort values for each document returned are also returned as part of