From dbf17152d18bd10b456ea353cee0fc66001dc231 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Wed, 29 Nov 2017 17:31:39 +0100 Subject: [PATCH] docs: use `doc_value_fields` fields as alternative for nested inner hits _source fetching instead of stored fields as doc values are more likely to be enabled by default --- .../search/request/inner-hits.asciidoc | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/reference/search/request/inner-hits.asciidoc b/docs/reference/search/request/inner-hits.asciidoc index fceb37418eb..ca459fe801e 100644 --- a/docs/reference/search/request/inner-hits.asciidoc +++ b/docs/reference/search/request/inner-hits.asciidoc @@ -200,7 +200,7 @@ its `_source` field. To include the source of just the nested document, the sour the relevant bit for the nested document is included as source in the inner hit. Doing this for each matching nested document has an impact on the time it takes to execute the entire search request, especially when `size` and the inner hits' `size` are set higher than the default. To avoid the relatively expensive source extraction for nested inner hits, one can disable -including the source and solely rely on stored fields. Like this: +including the source and solely rely on doc values fields. Like this: [source,js] -------------------------------------------------- @@ -210,13 +210,7 @@ PUT test "doc": { "properties": { "comments": { - "type": "nested", - "properties": { - "text": { - "type": "text", - "store": true - } - } + "type": "nested" } } } @@ -248,7 +242,7 @@ POST test/_search }, "inner_hits": { "_source" : false, - "stored_fields" : ["comments.text"] + "docvalue_fields" : ["comments.text.keyword"] } } } @@ -290,7 +284,7 @@ Response not included in text but tested for completeness sake. }, "_score": 1.0444683, "fields": { - "comments.text": [ + "comments.text.keyword": [ "words words words" ] } @@ -326,10 +320,6 @@ PUT test "comments": { "type": "nested", "properties": { - "message": { - "type": "text", - "store": true - }, "votes": { "type": "nested" }