Hi,
I have a little problem with aggregations.
Is it possible to filter parents in aggregations.
If i try
> "aggregations": {
> "sleeping": {
> "filter": {
> "bool": {
> "must": [
> {
> "term": {
> "objectGroup": "housing"
> }
> },
> {
> "nested": {
> "path": "objectMemberInformation",
> "query": {
> "bool": {
> "must": [
> {
> "term": {
> "objectMemberInformation.objectNumber": "5174602"
> }
> }
> ]
> }
> }
> }
> }
> ]
> }
> },
> "aggregations": {
> "sleeping": {
> "nested": {
> "path": "objectMemberInformation"
> },
> "aggregations": {
> "sleepingCount": {
> "range": {
> "field": "objectMemberInformation.detailRoomSleeping",
> "ranges": [
> {
> "from": 1
> },
> {
> "from": 2
> },
> {
> "from": 3
> },
> {
> "from": 4
> },
> {
> "from": 5
> },
> {
> "from": 6
> },
> {
> "from": 7
> },
> {
> "from": 8
> }
> ]
> }
> }
> }
> }
> }
> }
> }
The filter of objectNumber is not used in aggregations "sleepingCount"
If I start the aggregation with nested and ignore the filter "housing" it works.
> "aggregations": {
> "sleeping": {
> "nested": {
> "path": "objectMemberInformation"
> },
> "aggregations": {
> "sleeping": {
> "filter": {
> "bool": {
> "must": [
> {
> "term": {
> "objectMemberInformation.objectNumber": "5174602"
> }
> }
> ]
> }
> },
> "aggregations": {
> "sleepingCount": {
> "range": {
> "field": "objectMemberInformation.detailRoomSleeping",
> "ranges": [
> {
> "from": 1
> },
> {
> "from": 2
> },
> {
> "from": 3
> },
> {
> "from": 4
> },
> {
> "from": 5
> },
> {
> "from": 6
> },
> {
> "from": 7
> },
> {
> "from": 8
> }
> ]
> }
> }
> }
> }
> }
> }
> }
Is it possible to combine them?
Thanks a lot