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

Add has parent query #8365

Merged
merged 3 commits into from
Sep 26, 2024
Merged

Add has parent query #8365

merged 3 commits into from
Sep 26, 2024

Conversation

kolchfa-aws
Copy link
Collaborator

Add has parent query

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Fanit Kolchina <[email protected]>
Copy link

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

Copy link
Collaborator

@Naarcha-AWS Naarcha-AWS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@natebower natebower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolchfa-aws Please see my comments and changes and let me know if you have any questions. Thanks!

_field-types/supported-field-types/join.md Outdated Show resolved Hide resolved
_field-types/supported-field-types/join.md Outdated Show resolved Hide resolved
_field-types/supported-field-types/nested.md Outdated Show resolved Hide resolved
_field-types/supported-field-types/nested.md Outdated Show resolved Hide resolved
@@ -188,6 +322,7 @@ The following table lists all top-level parameters supported by `has_child` quer
| `max_children` | Optional | The maximum number of matching child documents for a parent document. If exceeded, the parent document is excluded from the search results. |
| `min_children` | Optional | The minimum number of matching child documents required for a parent document to be included in the results. If not met, the parent is excluded. Default is `1`.|
| `score_mode` | Optional | Defines how scores of matching child documents influence the parent document's score. Valid values are: <br> - `none`: Ignores the relevance scores of child documents and assigns a score of `0` to the parent document. <br> - `avg`: Uses the average relevance score of all matching child documents. <br> - `max`: Assigns the highest relevance score from the matching child documents to the parent. <br> - `min`: Assigns the lowest relevance score from the matching child documents to the parent. <br> - `sum`: Sums the relevance scores of all matching child documents. <br> Default is `none`. |
| `inner_hits` | Optional | If provided, returns the underlying hits (child documents) that matched the query. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "underlying" necessary here? "matched" => "match"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (see above)

```
{% include copy-curl.html %}

The response contains the products sorted by the highest parent `customer_satisfaction`:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either a comma should follow "products", or "the" should be omitted before "products".

_query-dsl/joining/has-parent.md Outdated Show resolved Hide resolved
_search-plugins/searching-data/inner-hits.md Outdated Show resolved Hide resolved
@@ -176,6 +176,140 @@ The response returns both brands:
}
```

## Retrieving inner hits

To return child documents that matched the query, provide the `inner_hits` parameter:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"matched" => "match"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to leave as "matched" because the parent documents are returned as a consequence of the child documents matching the query.


## Retrieving inner hits

To return parent documents that matched the query, provide the `inner_hits` parameter:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"matched" => "match"?

@kolchfa-aws kolchfa-aws merged commit c0127fb into main Sep 26, 2024
6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 26, 2024
* Add has parent query

Signed-off-by: Fanit Kolchina <[email protected]>

* Apply suggestions from code review

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>

---------

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>
Co-authored-by: Nathan Bower <[email protected]>
(cherry picked from commit c0127fb)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.17 Backport for version 2.17
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants