Hi there,
I am building an application here with some facets that I represent as
checkboxes. On each checkbox click I send such a parameter: ?
selected_facets=priceEUR_[100.0-200.0] and them my server-side
controller is building a request to ES.
The JSON that I get back is something like this:
"facets" : {
"description" : {
"Type" : "terms",
"missing" : 5437,
"terms" : [ ]
},
"name" : {
"Type" : "terms",
"missing" : 5437,
"terms" : [ ]
},
"priceEUR" : {
"Type" : "range",
"ranges" : [
{
"from" : 0.0,
"to" : 5.0,
"count" : 595,
"total" : 1457.8904200000002,
"mean" : 2.4502360000000003
},
{
"from" : 100.0,
"to" : 200.0,
"count" : 2207,
"total" : 879698.2974919997,
"mean" : 398.59460692886256
},
{
"from" : 5.0,
"to" : 100.0,
"count" : 2096,
"total" : 67012.99705100003,
"mean" : 31.97184973807253
}
]
}
}
and so I pass it to the JSP and iterate to display the checkboxes
again. My problem comes when I have to decide whether a checkbox is
checked or not. It would be really nice if priceEUR facet had a
'selected' attribute, or smth to distinguish the selected value, like
the one below:
"priceEUR" : {
"Type" : "range",
"ranges" : [
{
"from" : 0.0,
"to" : 5.0,
"count" : 595,
"total" : 1457.8904200000002,
"mean" : 2.4502360000000003
},
{
"from" : 100.0,
"to" : 200.0,
"count" : 2207,
"total" : 879698.2974919997,
"mean" : 398.59460692886256,
"selected" :
true
<<<<-------------------------------------|||||
},
{
"from" : 5.0,
"to" : 100.0,
"count" : 2096,
"total" : 67012.99705100003,
"mean" : 31.97184973807253
}
]
}
I can, of course do some computation in the controller and alter the
returned JSON, but I thought it would be a nice feature for ES to
return the selected value.
Thank you for your time.