浏览代码

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
Martijn van Groningen 8 年之前
父节点
当前提交
dbf17152d1
共有 1 个文件被更改,包括 4 次插入14 次删除
  1. 4 14
      docs/reference/search/request/inner-hits.asciidoc

+ 4 - 14
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
 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`
 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
 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]
 [source,js]
 --------------------------------------------------
 --------------------------------------------------
@@ -210,13 +210,7 @@ PUT test
     "doc": {
     "doc": {
       "properties": {
       "properties": {
         "comments": {
         "comments": {
-          "type": "nested",
-          "properties": {
-            "text": {
-              "type": "text",
-              "store": true
-            }
-          }
+          "type": "nested"
         }
         }
       }
       }
     }
     }
@@ -248,7 +242,7 @@ POST test/_search
       },
       },
       "inner_hits": {
       "inner_hits": {
         "_source" : false,
         "_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,
                   "_score": 1.0444683,
                   "fields": {
                   "fields": {
-                    "comments.text": [
+                    "comments.text.keyword": [
                       "words words words"
                       "words words words"
                     ]
                     ]
                   }
                   }
@@ -326,10 +320,6 @@ PUT test
         "comments": {
         "comments": {
           "type": "nested",
           "type": "nested",
           "properties": {
           "properties": {
-            "message": {
-              "type": "text",
-              "store": true
-            },
             "votes": {
             "votes": {
               "type": "nested"
               "type": "nested"
             }
             }