Skip to content

Instantly share code, notes, and snippets.

Last active Jul 14, 2022
What would you like to do?
Elasticsearch Nested Array Object Size Aggregation
# images field type is nested
GET products/_search
  "track_total_hits": true, 
  "size": 0, 
  "aggs": {
    "counts": {
      "terms": {
        "script": "params['_source']['images'].size()",
        "size": 10
Copy link

ar-hosseinkhani commented Aug 31, 2021

after many searches on different websites, finally I found this piece of code and It works! Thanks Mr. Hkuleckci

Copy link

hkulekci commented Aug 31, 2021

@ar-hosseinkhani welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment