Group by field
--------------

Id:1
Year:1999
Series title : Cool Series
Episode title: ep1

Id:2
Year:2000
Series title : Cool Series
Episode title: ep2

Id:3
Year:2001
Series title : Cool Series
Episode title: ep3

Id:4
Year:2005
Series title : Another series
Episode title: ep1

Id:5
Year:2006
Series title : Another series
Episode title: ep2

How could I collapse/aggregate by series title. And in output have custom calculated fields: min-max years, count of episodes

**Expected result**
Would be 1 object per series title.

Series title: Cool Series
Custom-field-year: 1999-2001
Total-count: 3

Series title: Another series
Custom-field-year: 2005-2006
Total-count: 2

Group by field which may be null
--------------------------------

Could it be possible to use agg terms to group objects into one by series title and those that have no series title - would be a separate objects.

Id:1
Year:1999
Series title : Cool Series
Episode title: ep1

Id:2
Year:2000
Series title : Cool Series
Episode title: ep2

Id:3
Year:2001
Series title : Cool Series
Episode title: ep3

Id:4
Year:2005
Series title : Another series
Episode title: ep1

Id:5
Year:2006
Series title : Another series
Episode title: ep2

Id:6
Year:2008
Series title : null
Episode title: A Movie 1

Id:7
Year:2009
Series title : null
Episode title: The Movie 2

**Expected result in case 2**
Would be 1 object per series title and seeparate movies objects

Series title: Cool Series
Custom-field-year: 1999-2001
Total-count: 3

Series title: Another series
Custom-field-year: 2005-2006
Total-count: 2

Series title: null
Ep A Movie 1

Series title: null
Ep The Movie 2