How to Count repeated values in Kibana

I have an index storing family data. One of the properties is "childrenAges" which stores a list of the ages of the children in the family, see sample data below.

I need to be able to count the ages of children across the index, so using the test data below I need to see...

Aged 1 = 1
Aged 5 = 1
Aged 6 = 3
Aged 10 = 3

I can't find a way to count values by this repeating group. Is it possible to do this?

PUT test-family-data
{
  "mappings": {
    "properties": {
      "name": {
        "type": "keyword"
      },
      "childrenAges": {
        "type": "integer"
      }
    }
  }
}

POST test-family-data/_doc
{
  "name": "Smith",
  "childrenAges": [5,6,10, 10]
}


POST test-family-data/_doc
{
  "name": "Jones",
  "childrenAges": [1,6, 6, 10]
}

Hello @phil_hcs_tech

Maybe this solution can help you.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.