How to filter nested objects on a should query?

I have my mappings as below and I am doing a bool should query on name and other properties as shown below but what I need is that I want to filter CustomerPrices by CustomerId on response.
Each products have same CustomerIds so for eaxample;

product1 -CustomerPrice( CustomerId :1234 -Price:4) 
           CustomerPrice( CustomerId :567-Price:5)
            .
            .
 Product2 - CustomerPrice(CustomerId :1234 -Price:8)
            CustomerPrice(CustomerId :567-Price:10)
           .
           .

So according to that when I query Product1, response should have only customerPrice for customerId:1234

{
  "Product": {
    "properties": {
      "CustomerPrices": {
        "type": "nested",
        "properties": {
          "Price": {
            "store": true,
            "type": "float"
          },
          "CustomerId": {
            "type": "integer"
          }
        }
      },
      "Name": {
        "index": "not_analyzed",
        "store": true,
        "type": "string"
      }
    }
  }
}

I tried following query but this is not filtering nested objects. I guess it filters product objects as it makes sense because all products have customerId:1234

   "query":{
        "bool":{
          "should":[
            {
              "multi_match":{
                "type":"best_fields",
                "query":"product 1",
                "fields":[             
                  "Name^7"]
              }
            },
            {
              "multi_match":{
                "type":"best_fields",
                "query":"product 1",
                "operator":"and",
                "fields":[
                  "Code^10",           
                  "ShortDescription^6"]
              }
            },      
            {
              "nested":{
                "query":{
                  "term":{
                    "CustomerPrices.CustomerId":{
                      "value":1234
                    }
                  }
                },
                "path":"CustomerPrices"
              }
            }]
        }
      },

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