Facet Filters
FacetFilterCondition filters on categorical or keyword fields. Use it inside a ComplexFilterInput to match or exclude specific discrete values such as states, types, or identifiers.
Type Definition
graphql
input FilterConditionInput {
property: String! # The Elasticsearch field name
operator: String! # in | not_in
values: [String!]! # The list of values to match against
}Facet conditions are inline within FilterConditionInput — set property, operator, and values directly (no nested facet: wrapper needed).
Operators
| Operator | Description | Example |
|---|---|---|
in | Field value must be one of the listed values | state in ["OPENED", "DRAFT"] |
not_in | Field value must NOT be in the listed values | state not_in ["COMPLETED", "CANCELLED"] |
Multiple values in the array act as an OR within that single condition — in: ["OPENED", "DRAFT"] matches records where state is OPENED or DRAFT.
Common Filterable Fields by Domain
Orders
| Field | Type | Example Values |
|---|---|---|
state | enum | DRAFT, OPENED, COMPLETED |
type | enum | B2C, B2B |
priority | enum | LOW, NORMAL, HIGH, URGENT |
currency | string | EUR, USD, GBP |
dispatchingType | enum | AUTOMATIC, MANUAL |
inventoryPolicy | enum | DENY, ALLOW, SKIP, ADJUST |
organizationId | string | org-abc123 |
Products
| Field | Type | Example Values |
|---|---|---|
status | enum | ACTIVE, INACTIVE, ARCHIVED |
model | string | STANDARD, BUNDLE |
organizationId | string | org-abc123 |
Stock
| Field | Type | Example Values |
|---|---|---|
status | enum | ACTIVE, INACTIVE |
model | string | STANDARD, VIRTUAL |
locationId | string | loc-warehouse-1 |
organizationId | string | org-abc123 |
Shipments
| Field | Type | Example Values |
|---|---|---|
state | enum | CREATED, SHIPPED, DELIVERED |
lastEvent | string | DELIVERED, RETURNED, EXPIRED |
carrier | string | DHL, COLISSIMO, UPS |
organizationId | string | org-abc123 |
Delivery Orders
| Field | Type | Example Values |
|---|---|---|
status | enum | PENDING, ACCEPTED, COMPLETED |
type | enum | STANDARD, RETURN |
organizationId | string | org-abc123 |
Locations
| Field | Type | Example Values |
|---|---|---|
locationType | enum | WAREHOUSE, STORE, VIRTUAL |
active | boolean | true, false |
organizationId | string | org-abc123 |
Examples
Filter by multiple states (OR within the array)
graphql
complexFilters: {
must: [
{ property: "state", operator: in, values: ["OPENED", "DRAFT"] }
]
}Exclude completed and cancelled orders
graphql
complexFilters: {
mustNot: [
{ property: "state", operator: in, values: ["COMPLETED", "CANCELLED"] }
]
}Equivalent using not_in directly:
graphql
complexFilters: {
must: [
{ property: "state", operator: not_in, values: ["COMPLETED", "CANCELLED"] }
]
}Filter orders of a specific type for an organization
graphql
complexFilters: {
must: [
{ property: "organizationId", operator: in, values: ["org-abc123"] },
{ property: "type", operator: in, values: ["B2C"] }
]
}Filter active locations of a specific type
graphql
complexFilters: {
must: [
{ property: "organizationId", operator: in, values: ["org-abc123"] },
{ property: "locationType", operator: in, values: ["WAREHOUSE"] },
{ property: "active", operator: in, values: ["true"] }
]
}Full Example — Search Orders by Type and State
bash
curl -X POST https://api-v3.happycolis.com/graphql \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "query SearchOrders($input: SearchInput!) { orderRecords(input: $input) { hits { objectID invoiceNumber state type } nbHits } }",
"variables": {
"input": {
"complexFilters": {
"must": [
{ "property": "organizationId", "operator": "in", "values": ["org-abc123"] },
{ "property": "type", "operator": "in", "values": ["B2C"] },
{ "property": "state", "operator": "in", "values": ["OPENED", "DRAFT"] }
]
},
"hitsPerPage": 50,
"page": 0
}
}
}'javascript
const response = await fetch('https://api-v3.happycolis.com/graphql', {
method: 'POST',
headers: {
'Authorization': `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: `query SearchOrders($input: SearchInput!) {
orderRecords(input: $input) {
hits { objectID invoiceNumber state type }
nbHits
}
}`,
variables: {
input: {
complexFilters: {
must: [
{ property: 'organizationId', operator: 'in', values: ['org-abc123'] },
{ property: 'type', operator: 'in', values: ['B2C'] },
{ property: 'state', operator: 'in', values: ['OPENED', 'DRAFT'] },
],
},
hitsPerPage: 50,
page: 0,
},
},
}),
});
const { data } = await response.json();python
import requests
response = requests.post(
'https://api-v3.happycolis.com/graphql',
headers={
'Authorization': f'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
},
json={
'query': '''
query SearchOrders($input: SearchInput!) {
orderRecords(input: $input) {
hits { objectID invoiceNumber state type }
nbHits
}
}
''',
'variables': {
'input': {
'complexFilters': {
'must': [
{'property': 'organizationId', 'operator': 'in', 'values': ['org-abc123']},
{'property': 'type', 'operator': 'in', 'values': ['B2C']},
{'property': 'state', 'operator': 'in', 'values': ['OPENED', 'DRAFT']},
],
},
'hitsPerPage': 50,
'page': 0,
}
},
}
)
data = response.json()php
<?php
$client = new \GuzzleHttp\Client();
$response = $client->post('https://api-v3.happycolis.com/graphql', [
'headers' => [
'Authorization' => 'Bearer ' . $ACCESS_TOKEN,
'Content-Type' => 'application/json',
],
'json' => [
'query' => 'query SearchOrders($input: SearchInput!) {
orderRecords(input: $input) {
hits { objectID invoiceNumber state type }
nbHits
}
}',
'variables' => [
'input' => [
'complexFilters' => [
'must' => [
['property' => 'organizationId', 'operator' => 'in', 'values' => ['org-abc123']],
['property' => 'type', 'operator' => 'in', 'values' => ['B2C']],
['property' => 'state', 'operator' => 'in', 'values' => ['OPENED', 'DRAFT']],
],
],
'hitsPerPage' => 50,
'page' => 0,
],
],
],
]);
$data = json_decode($response->getBody(), true);go
package main
import (
"bytes"
"encoding/json"
"net/http"
)
payload, _ := json.Marshal(map[string]interface{}{
"query": `query SearchOrders($input: SearchInput!) {
orderRecords(input: $input) {
hits { objectID invoiceNumber state type }
nbHits
}
}`,
"variables": map[string]interface{}{
"input": map[string]interface{}{
"complexFilters": map[string]interface{}{
"must": []map[string]interface{}{
{"property": "organizationId", "operator": "in", "values": []string{"org-abc123"}},
{"property": "type", "operator": "in", "values": []string{"B2C"}},
{"property": "state", "operator": "in", "values": []string{"OPENED", "DRAFT"}},
},
},
"hitsPerPage": 50,
"page": 0,
},
},
})
req, _ := http.NewRequest("POST", "https://api-v3.happycolis.com/graphql", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer "+ACCESS_TOKEN)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)Related
- Complex Filters — Combine facet filters with boolean logic
- Numeric Filters — Filter on numeric and date fields
- Nested Filters — Filter on nested document fields