How to store ecommerce set/nonset products in elasticsearch?

Hi,

How to store ecommerce set/nonset products in elasticsearch with aggregation,sort,search.

currently I am using parent-child relationship with it, but for aggregation and sort it need to store merged values in the parent.that is not working well with proper aggregation count.So it doesn't satisfy my requirement.

Current schema is as follow,

Parent .
{
_id: "s113",
name: "sample product set",
"mrps" :[
100,
200
]
}

Children
{
_id:"c100",
parent: "s113",
name: "sample product set",
"mrp":100
},
{
_id:"c101",
parent: "s113",
name: "sample product set",
"mrp" : 100
},
{
_id:"c102",
parent: "s113",
name: "sample product set",
"mrp" :200
},
{
_id:"c103",
parent: "s113",
name: "sample product set",
"mrp": 200
}

I am performing aggregation,sort and search on parent and filtering done at child to fetch single client.

Are you sure the aggregation counts are wrong if you don't pull "mrps" up to the parent?

Have you explored nested documents instead?

Mike McCandless

Yes I had used nested documents but it also gives wrong result.

Parent child become wrong in following scenario.
Parent .
{
_id: "s113",
name: "sample product set",
"mrps" :[
100,
200
]
}

Children
{
_id:"c100",
parent: "s113",
name: "sample product set",
"mrp":100
},
{
_id:"c101",
parent: "s113",
name: "sample product set",
"mrp" : 100
},
{
_id:"c102",
parent: "s113",
name: "sample product set",
"mrp" :200
},
{
_id:"c103",
parent: "s113",
name: "sample product set",
"mrp": 200
}

I had used children aggregation.result comes like this.

Price:
100 - 2 counts
200 - 2 counts

But my expected output is like:

100 - 1 count
200 - 1 count

Please provide me an solution as early as possible.