ElasticSearch Aggregations Facet
Example of "extending" facet for elastic
DELETE cars
POST cars/car
{
"title": "red audi",
"manufacturer": "audi",
"color": "red"
}
POST cars/car
{
"title": "red bmw",
"manufacturer": "bmw",
"color": "red"
}
POST cars/car
{
"title": "red zaz",
"manufacturer": "zaz",
"color": "red"
}
POST cars/car
{
"title": "blue audi",
"manufacturer": "audi",
"color": "blue"
}
POST cars/car
{
"title": "blue bmw",
"manufacturer": "bmw",
"color": "blue"
}
POST cars/car
{
"title": "blue zaz",
"manufacturer": "zaz",
"color": "blue"
}
POST cars/car
{
"title": "green audi",
"manufacturer": "audi",
"color": "green"
}
POST cars/car
{
"title": "green bmw",
"manufacturer": "bmw",
"color": "green"
}
POST cars/car
{
"title": "green zaz",
"manufacturer": "zaz",
"color": "green"
}
POST cars/_search
{
"query": {
"term": {
"manufacturer.keyword": {
"value": "zaz"
}
}
},
"post_filter": {
"term": {
"color.keyword": "green"
}
},
"aggs" : {
"all_colors": {
"terms" : { "field" : "color.keyword" }
}
}
}