# images field type is nested
GET products/_search
{
"track_total_hits": true,
"size": 0,
"aggs": {
"counts": {
"terms": {
"script": "params['_source']['images'].size()",
"size": 10
}
}
}
}
Last active
June 23, 2023 11:58
-
-
Save hkulekci/694e042b547939397e847c7c99b1ecdd to your computer and use it in GitHub Desktop.
Elasticsearch Nested Array Object Size Aggregation
@ar-hosseinkhani welcome 👍
can it be done without script?
@pinturic Maybe you can use value_count
aggregation with field images.id
. I did not try but it could work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after many searches on different websites, finally I found this piece of code and It works! Thanks Mr. Hkuleckci