Hi,

I would like to run a post filter on a nested value, but cannot seem to get 
this working.
This is my very simple document structure:

{"code":"ABC", "variants": [{"sku":"123", "price": 15}], "colour":"blue"}
{"code":"DEF", "variants": [{"sku":"456", "price": 30}], "colour":"red"}

I have the following mapping

{"variants": {"type":"nested"}

Which gives me this when I query the mappings, so I know it's in place.

{"variants": {"type":"nested", "properties": { "price": { "type": "long"}}

I run a search to collate aggregations on the colour:

"aggs": { "colour": { "terms": { "field": "colour" } } }

This works a treat and I get Blue 1, and Red 1 returned.

I wanted to run a post filter on variants.price > 20.
I have tried

    "post_filter": {
            "range": {"variants.price":{ "gt": 20.0 }}
    }

And I get 0 results
I have also tried 

"post_filter": {
   "nested": {
        "path": "variants",
         "post_filter":{
         "range": {"price":{ "gt": 20.0 }}
         }
     }
}

But this crashes.

Can anyone help?

Regards,
Dev

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/79b7583c-6336-495b-bef1-d9ba0a9e0b83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to