-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[BUG] Missing inner hits in top hits of an aggregation results since upgrade to 2.13.0 #13467
Comments
@martijnbolhuis Looks like a regression. Care to add a (failing) YAML REST test that reproduces this problem and try to bisect it to where the bug was introduced? |
@dblock Thanks for your response. The following YAML REST test reproduces the problem. It seems that commit 965d85a introduces the problem. See also #12503 I've added the following file setup:
- do:
indices.create:
index: test_1
body:
settings:
number_of_replicas: 0
mappings:
properties:
list_id:
type: integer
names:
type: nested
properties:
full_name:
type: text
- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_id: 1
- list_id: 1
names:
- full_name: John Doe
- full_name: John Micheal Doe
- index:
_index: test_1
_id: 2
- list_id: 2
names:
- full_name: Jane Doe
- full_name: Jane Michelle Doe
---
"Include inner hits in top hits":
- do:
search:
rest_total_hits_as_int: true
body:
query:
nested:
path: names
query:
match:
names.full_name: Doe
inner_hits: { }
size: 0
aggs:
lists:
terms:
field: list_id
aggs:
top_result:
top_hits:
size: 10
- length: { hits.hits: 0 }
- length: { aggregations.lists.buckets: 2 }
- length: { aggregations.lists.buckets.0.top_result.hits.hits: 1 }
- length: { aggregations.lists.buckets.0.top_result.hits.hits.0.inner_hits.names.hits.hits: 2 }
- length: { aggregations.lists.buckets.1.top_result.hits.hits: 1 }
- length: { aggregations.lists.buckets.1.top_result.hits.hits.0.inner_hits.names.hits.hits: 2 } In the following my test fails:
And in the following my test works:
|
@martijnbolhuis Thank you for diving deep into this one. cc: @jainankitk |
Describe the bug
I have query on a nested field
names.full_name
. I have enabled inner hits on this query. Furthermore, I have added an aggregation on the (non nested) fieldlist_id
and I'm using the top hits function to include results per bucket of the aggregation.In OpenSearch version 2.12.0, the top hits included the inner hits (on
names.full_name
) but in version 2.13.0 these inner hits are missing.Related component
Other
To Reproduce
The following script reproduces the problem:
Expected behavior
The following is the expected result which OpenSearch 2.12.0 gives. This includes
inner_hits
.The actual result in 2.13.0 is the following which is missing the
inner_hits
:Additional Details
Plugins
No plugins / default opensearch installation
Host/Environment (please complete the following information):
I'm using opensearch from docker: https://hub.docker.com/layers/opensearchproject/opensearch/2.13.0/images/sha256-00f052502297cbc599af34b93605e1eb485438f0e9670dc8d82a4976da7d3feb?context=explore
Additional context
I set
"size": 0
in the main query because I'm not interested in the "regular" hits but only in the aggregated top hits. If I change this to for example"size": 100
, the "regular" hits will include the inner hits so there it works as expected. But I do this, the top hits still will not include the inner hits.The text was updated successfully, but these errors were encountered: