This represents my mapping:
{
"name": {"type": "string", "include_in_all": true},
"properties": {
"type": "nested",
"properties": {
"name": {"type": "string"},
"value": {"type": "string"}
}
}
How can I use facetted search for the value of 'properties.value'? Here is an example document:
{
"name": "Testproduct",
"properties": [{
"name": "Color",
"value": "Green"
}, {
"name": "Size",
"value": "M"
}]
}
I want to build a facetted list (only) by the "Color"-property. So the result should look like this:
Red: 7 times
Green: 5 times
Blue: 1 times
This is what I have tried so far:
{
"size": 1000,
"query": {
"query_string": {
"query": " ... ",
"default_operator": "AND"
}
},
"facets": {
"resolution": {
"nested": "properties",
"facet_filter": {
"term": {
"name": "Color"
}
},
"terms_stats": {
"key_field": "name",
"value_field": "value"
}
}
}
}
If I execute this search query, I get the following response:
FacetPhaseExecutionException[Facet [resolution]: value_field [value] isn't a number field, but a string];
I barely understand the response, but I have no idea what I have done wrong by concept.