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
This commit is contained in:
Martijn van Groningen 2017-11-29 17:31:39 +01:00
parent 65e602c2be
commit dbf17152d1
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A

View File

@ -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"
}