This is the case:
I have two type
sessions's mapping:
u'sessions': {u'_all': {u'enabled': False},
u'dynamic': u'false',
u'properties': {
u'rt': {u'index': u'not_analyzed', u'type': u'string'},
u'sid': {u'index': u'not_analyzed', u'type': u'string'},
u'ch': {u'index': u'not_analyzed', u'type': u'string'}
}
}
u'events': {
u'_all': {u'enabled': False},
u'_parent': {u'type': u'sessions'},
u'_routing': {u'required': True},
u'properties':{
u'eid': {u'index': u'not_analyzed', u'type': u'string'}
}
}
i want to aggs the events by sessions's ch
like this:
{
"ch1" : 22, // 22 is event count
"ch2":45,
}
How do I construct a query?