Homepage

Filtering and Sorting

Last edit: Jan 25, 2024

Warning

This article promotes customizations, listings and people GraphQL queries, which are deprecated due to the limited configuration option. To leverage the power of ElasticSearch, we recommend using JSON Documents, which allows you to define your own ElasticSearch mapping and have full control on what gets stored in the ElasticSearch.

Filtering using Elasticsearch is a slightly different operation from Search, but they are easy to confuse. This topic explains filtering and sorting using GraphQL queries.

Filtering

To filter items by exact value use

  • user: for people
people(user: { first_name: "darek" }) {
  results {
    email
  }
}

Please note, that there is no filter argument in the customizations entry point. You specify filtering operations directly.

{
  customizations(
    page: 1,
    per_page: 210
    properties: [
      { name: "name", value: "alpha|beta" }
    ]
    name: "company"
  ) {
    total_entries
    results {
      id
      name
      properties
    }
  }
}

Sorting

Use sort to change your the ordering of your collection.
When sorting automatically, the raw field is used.

{
  customizations(
    page: 1,
    per_page: 210
    sort: [
      { name: "properties.url", order: "ASC" }
      { name: "properties.name", order: "DESC" }
    ]
    name: "company"
  ) {
    total_entries
    results {
      id
      name
      url: property(name: "url")
      name: property(name: "name")
    }
  }
}

Questions?

We are always happy to help with any questions you may have.

contact us