Filters
For more complex scenarios filter can be applied via the POST search endpoint.
Filter: color:blue AND gender:male
Filter for Men shoes in colors black, blue:
{
"q": "shoes",
"searchFilters": [
{
"filterType": "term",
"id": "color",
"color": [
"black",
"blue"
]
},
{
"filterType": "term",
"id": "gender",
"values": [
"male"
]
}
]
}
Filter for Men shoes in colors black, blue or shoes on sale:
Filter: (color:blue AND gender:male) OR sale:true
{
"q": "shoes",
"searchFilters": [
{
"opType": "bool",
"operator": "OR",
"filters": [
{
"opType": "bool",
"operator": "AND",
"filters": [
{
"filterType": "term",
"id": "color",
"values": [
"black",
"blue"
]
},
{
"filterType": "term",
"id": "gender",
"values": [
"male"
]
}
]
},
{
"filterType": "term",
"id": "sale",
"values": [
"true"
]
}
]
}
]
}
Filter for Men shoes in colors black, blue or shoes on sale with are on stock:
Filter: ((color:blue AND gender:male) OR sale:true) AND -stock:0
{
"q": "shoes",
"searchFilters": [
{
"opType": "bool",
"operator": "OR",
"filters": [
{
"opType": "bool",
"operator": "AND",
"filters": [
{
"filterType": "term",
"id": "color",
"values": [
"black",
"blue"
]
},
{
"filterType": "term",
"id": "gender",
"values": [
"male"
]
}
]
},
{
"filterType": "term",
"id": "sale",
"values": [
"true"
]
}
]
},
{
"opType": "bool",
"operator": "NOT",
"filters": [
{
"filterType": "term",
"id": "stock",
"values": [
"0"
]
}
]
}
]
}