Empty buckets for filtered nested aggregation in 5.0 version


(Romanova Maria) #1

Hello!
I have some problem with filtered nested terms bucket aggregation.

Mappings data for 'region' field:

{
        'type': 'nested',
        'properties': {
              'country': {'type': 'keyword'},
              'province': {'type': 'keyword'},
              'district': {'type': 'keyword'},
              'city': {'type': 'keyword'}
        }
}

Each document may have some values of "region", i.e. it is array of nested type.
I need to do bucket terms aggregation e.g for "region.city" field with using filter aggregation by some "region.province" value. So, my aggregation section looks like:

{
    'region': {
        'nested': {
            'path': 'region'
        },
        'aggs': {
            'region-filter': {
                'filter':
                    {'term': {'region.province': value}}
                ,
                'aggs': {
                    'city': {
                        'terms': {
                            'field': 'region.city',
                        },
                    }
                }
            }
        }
    }
}

But in returned result my city-buckets are always empty. Is it some bug or there is something wrong in my aggregation section?


(system) #2

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