I have this product JSON document that I generate from my database.

{
    "product": {
"name": "My product",
"description" : "My product description",
"variations": [
{
                                "sku": "BLARED10",
                                "price": 10.15,
"attributes" : {
                                        "colour": "red",
        "size": 10,
"material": "leather",
"fastening": "lace"
}
},
{
"sku": "BLABLUE11",
                                "price": 10.15,
"attributes" : {
                                        "colour": "blue",
        "size": 11,
"material": "leather",
"fastening": "slip",
"onSale": 1
}
}
]
}
}

I am currently using this mapping for indexing it in elastic-search:
{
    "product": {
"properties": {
"name": {"type": "string"},
"description": {"type": "string"},
"variations": {
"type": "nested",
"properties": {
"sku": {"type": "string"},
"price": {"type": "float"},
"attributes" : {
"type": "object"
}
}
}
}
     }
}

Is this the correct way to map it, and if yes, how can I query for example 
all the products that have at least one variation with price 10.15 and 
colour blue?

Thanks!

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/92728333-eed8-4d35-85b0-bd5427885f9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to