Skip to content

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 ​

OperatorDescriptionExample
inField value must be one of the listed valuesstate in ["OPENED", "DRAFT"]
not_inField value must NOT be in the listed valuesstate 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 ​

FieldTypeExample Values
stateenumDRAFT, OPENED, COMPLETED
typeenumB2C, B2B
priorityenumLOW, NORMAL, HIGH, URGENT
currencystringEUR, USD, GBP
dispatchingTypeenumAUTOMATIC, MANUAL
inventoryPolicyenumDENY, ALLOW, SKIP, ADJUST
organizationIdstringorg-abc123

Products ​

FieldTypeExample Values
statusenumACTIVE, INACTIVE, ARCHIVED
modelstringSTANDARD, BUNDLE
organizationIdstringorg-abc123

Stock ​

FieldTypeExample Values
statusenumACTIVE, INACTIVE
modelstringSTANDARD, VIRTUAL
locationIdstringloc-warehouse-1
organizationIdstringorg-abc123

Shipments ​

FieldTypeExample Values
stateenumCREATED, SHIPPED, DELIVERED
lastEventstringDELIVERED, RETURNED, EXPIRED
carrierstringDHL, COLISSIMO, UPS
organizationIdstringorg-abc123

Delivery Orders ​

FieldTypeExample Values
statusenumPENDING, ACCEPTED, COMPLETED
typeenumSTANDARD, RETURN
organizationIdstringorg-abc123

Locations ​

FieldTypeExample Values
locationTypeenumWAREHOUSE, STORE, VIRTUAL
activebooleantrue, false
organizationIdstringorg-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)

HappyColis API Documentation