Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify that inner_hits must be used to access nested fields. #42724

Merged
merged 1 commit into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions docs/reference/mapping/types/nested.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ Nested documents can be:
* sorted with <<nested-sorting,nested sorting>>.
* retrieved and highlighted with <<nested-inner-hits,nested inner hits>>.

[IMPORTANT]
=============================================

Because nested documents are indexed as separate documents, they can only be
accessed within the scope of the `nested` query, the
`nested`/`reverse_nested` aggregations, or <<nested-inner-hits,nested inner hits>>.

For instance, if a string field within a nested document has
<<index-options,`index_options`>> set to `offsets` to allow use of the postings
during the highlighting, these offsets will not be available during the main highlighting
phase. Instead, highlighting needs to be performed via
<<nested-inner-hits,nested inner hits>>. The same consideration applies when loading
fields during a search through <<search-request-docvalue-fields, `docvalue_fields`>>
or <<search-request-stored-fields, `stored_fields`>>.

=============================================

[[nested-params]]
==== Parameters for `nested` fields
Expand All @@ -178,21 +194,6 @@ The following parameters are accepted by `nested` fields:
may be added to an existing nested object.


[IMPORTANT]
=============================================

Because nested documents are indexed as separate documents, they can only be
accessed within the scope of the `nested` query, the
`nested`/`reverse_nested` aggregations, or <<nested-inner-hits,nested inner hits>>.

For instance, if a string field within a nested document has
<<index-options,`index_options`>> set to `offsets` to allow use of the postings
during the highlighting, these offsets will not be available during the main highlighting
phase. Instead, highlighting needs to be performed via
<<nested-inner-hits,nested inner hits>>.

=============================================

[float]
=== Limits on `nested` mappings and objects

Expand Down
4 changes: 4 additions & 0 deletions docs/reference/search/request/docvalue-fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ on their mappings: `long`, `double` and other numeric fields are formatted as
numbers, `keyword` fields are formatted as strings, `date` fields are formatted
with the configured `date` format, etc.

NOTE: On its own, `docvalue_fields` cannot be used to load fields in nested
objects -- if a field contains a nested object in its path, then no data will
be returned for that docvalue field. To access nested fields, `docvalue_fields`
must be used within an <<search-request-inner-hits, `inner_hits`>> block.
5 changes: 5 additions & 0 deletions docs/reference/search/request/stored-fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Script fields can also be automatically detected and used as fields, so
things like `_source.obj1.field1` can be used, though not recommended, as
`obj1.field1` will work as well.

NOTE: On its own, `stored_fields` cannot be used to load fields in nested
objects -- if a field contains a nested object in its path, then no data will
be returned for that stored field. To access nested fields, `stored_fields`
must be used within an <<search-request-inner-hits, `inner_hits`>> block.

==== Disable stored fields entirely

To disable the stored fields (and metadata fields) entirely use: `_none_`:
Expand Down