Problem nested filter

Hi,
sorry for my bad english.

i have a little product search project.

in this project i have one program (main product) with similiars product
types (product) i.e. program in size XXL.
in this product-type i have nested price objects with country and currency.
now i want to facet the price by range by given country token. but my price
range filter loop over all prices, not the given country price.

where´s my error in brain?

have anybody an idea?

here´s my mapping

"mappings": {
"program": {
"_all": {
"enabled": true,
"index_analyzer": "nGram_analyzer",
"search_analyzer": "whitespace_analyzer"
},
"_source": {
"enabled": true,
"compress": true
},
"dynamic": "strict",
"properties": {
"title": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"programmid": {
"type": "string",
"store": true,
"index": "analyzed",

"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"shippingcountry": {
"include_in_all": false
"type": "string",
"store": true,
"index": "analyzed",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"products": {
"type": "nested",
"store": true,
"index": "analyzed",
"fields": {
"raw": {
"type": "nested",
"index": "not_analyzed"
}
},
"properties": {
"size": {
"include_in_all": false
"type": "string",
"store": true,
"index": "analyzed",
"analyzer": "english",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"prices": {
"type": "nested",
"store": true,
"index": "analyzed",
"analyzer": "english",
"fields": {
"raw": {
"type": "nested",
"index": "not_analyzed"
}
},
"properties": {
"price": {
"type": "float",
"store": true,
"index": "analyzed",
"null_value": 0,
"analyzer": "english",
"fields": {
"raw": {
"type": "float",
"index": "not_analyzed"
}
}
},
"country": {
"include_in_all": false
"type": "string",
"store": true,
"index": "analyzed",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"currency": {
"include_in_all": false
"type": "string",
"store": true,
"index": "analyzed",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
}
}
}
}

and my request

{
"sort": [
{
"title.raw": {
"order": "asc"
}
}
],
"size": 0,
"from": 0,
"aggs": {
"productprices": {
"nested": {
"path": "products"
},
"aggs": {
"prices": {
"nested": {
"path": "products.prices"
},
"aggs": {
"min_price": {
"query": {
"filter": {
"bool": {
"must": [
{
"term": {

"products.prices.country.raw": "GB"
}
}
]
}
}
},
"range": {
"field": "products.prices.price",
"ranges": [
{
"to": 50
},
{
"from": 50,
"to": 100
},
{
"from": 100
}
]
}
}
}
}
}
}
},
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"shippingcountry.raw": "GB"
}
},
{
"nested": {
"path": "products",
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"nested": {
"path":
"products.prices",
"query": {
"filtered":
{

"query": {

"match_all": {}
},

"filter": {

"bool": {

"must": [

{
                                                                        
    "term": {
                                                                        
        "products.prices.country.raw": "GB"
                                                                        
    }
                                                                        
}

]
}
}
}
}
}
}
]
}
}
}
}
}
}
]
}
}
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/83c37580-adf7-4e38-9515-1bc4e0d79daf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.