Hi, I want to top term values like this:
{
"products":[
{
"identifier":1,
"name":"Foo",
"quantity":2
},
{
"identifier":2,
"name":"Bar",
"quantity":3
}
]
}
But instead of considering simply the times each record occurs, I want to query the count times quantity field, like considering the identifier 2 product to 3 instead of one in the above example.
How could I do it?
My current query is:
{
"size":0,
"aggs":{
"products":{
"nested":{
"path":"products"
},
"aggs":{
"top-terms-aggregation":{
"terms":{
"field":"products.identifier",
"size":10
}
}
}
}
}
}