Closed
Description
Describe the bug
Aggregation value_count
on field of nested
type returns incorrect result. This issue only happens on nested
type, object
type without nested
looks fine.
Related component
Search:Aggregations
To Reproduce
Repro:
# create an test index with nested field
PUT test_nested_field_index
{
"mappings" : {
"properties": {
"patients": {
"type" : "nested"
}
}
}
}
# add some testing data
PUT test_nested_field_index/_doc/100
{
"patients": [
{"name" : "John Doe", "age" : 56, "smoker" : true},
{"name" : "Mary Major", "age" : 85, "smoker" : false}
]
}
# value_count should return 2 instead of 0
GET test_nested_field_index/_search
{
"size": 0,
"aggs": {
"count_patients_name": {
"value_count": {
"field": "patients.name.keyword"
}
}
}
}
Expected behavior
value_count
should return 2 instead of 0
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: Mac
- Version 2.14
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done