PUT /test-product
{
"mappings": {
"properties": {
"profile": {
"type": "nested"
},
"product": {
"type": "nested"
}
}
}
}
i have a index that name's 'test-product'
POST /test-product/_bulk
{ "index" : { "_id" : "1" } }
{ "user":"1", "profile":{"name":"AA", "age": "11", "height": "30"}, "product": {"price": "333", "name": "test", "weight": "10"} }
{ "index" : { "_id" : "2" } }
{ "user":"2", "profile":{"name":"BB", "age": "20"}, "product": {"name": "test"}}
and that index have some docs
I want to get the results as below....
Case 1. when i search for user: 1
profile.name, profile.age, profile.height, product.price, product.name, product.weight
Case 2. when i search for user: 2
profile.name, profile.age, product.name
Is there a way?