Nested filter and parents in Aggregations

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

Sorry, it already works

> "aggregations": {
>     "sleeping": {
>       "filter": {
>         "bool": {
>           "must": [
>             {
>               "term": {
>                 "objectGroup": "housing"
>               }
>             }
>           ]
>         }
>       },
>       "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
> 						}
> 					  ]
> 					}
> 				  }
> 				}
>             }
>           }
>         }
>       }
>     }
>   }

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