From e2cb71e21b202979145f3e90dedf5590026a8320 Mon Sep 17 00:00:00 2001 From: AntonEliatra Date: Mon, 19 Aug 2024 17:08:47 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Signed-off-by: AntonEliatra --- _search-plugins/searching-data/inner-hits.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/_search-plugins/searching-data/inner-hits.md b/_search-plugins/searching-data/inner-hits.md index 4cdd6ff40c..1a48d2fc02 100644 --- a/_search-plugins/searching-data/inner-hits.md +++ b/_search-plugins/searching-data/inner-hits.md @@ -10,14 +10,12 @@ nav_order: 70 # Inner_hits -In OpenSearch, when you perform a search using parent-join or nested objects (for more information see [Join field type]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/join/) and [Nested field type]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/nested/)), the underlying hits that resulted in the hits being returned (child documents or nested inner objects) are hidden by default. Whether you are using parent/child, nested objects or both, there could be different reasons why retrieving these underlying hits is important. This is achieved using `inner_hits` parameter in the search query. +In OpenSearch, when you perform a search using [nested objects]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/nested/) or [parent-join]({{site.url}}{{site.baseurl}}/field-types/supported-field-types/join/), the underlying hits that matched the query and resulted in the hits being returned (nested inner objects or child documents) are hidden by default. Whether you are using parent/child, nested objects, or both, there could be different reasons why retrieving these underlying hits is important. You can retrieve inner hits using the `inner_hits` parameter in the search query. - -## Inner_hits with nested objects - -Nested objects allow you to index an array of objects and maintain their relationship within the same document. See the following example of using `inner_hits` parameter to retrieve underlying inner hits: +## Inner hits with nested objects +Nested objects allow you to index an array of objects and maintain their relationship within the same document. The following example uses the `inner_hits` parameter to retrieve the underlying inner hits. -1. Create index mapping with nested object: +1. Create an index mapping with a nested object: ```json PUT /my_index @@ -79,7 +77,7 @@ Nested objects allow you to index an array of objects and maintain their relatio ``` {% include copy-curl.html %} -This query searches for nested user objects with the name "John" and returns the matching nested documents within the inner_hits section of the response. The following is the retrieved result: +The preceding query searches for nested user objects with the name John and returns the matching nested documents within the `inner_hits` section of the response: ```json { @@ -138,8 +136,7 @@ This query searches for nested user objects with the name "John" and returns the } } ``` - -## Inner_hits with parent-child objects +## Inner hits with parent-child objects Parent-join relationships allow you to create relationships between documents of different types within the same index. See following example using search with `inner_hits` with parent/child objects: