API/behavior changes

To be able to set the attribute for distinct at search time your field must first be declared in the filterableAttributes of your index.

curl \\
  -X PUT '<http://localhost:7700/indexes/movies/settings/filterable-attributes>' \\
  -H 'Content-Type: application/json' \\
  --data-binary '[
    "genres",
    "director"
  ]'

Once your index settings are correctly setup you can use the distinct parameter on the search route. You’ll never see more than a single document with the same genre.

curl \\
  -X POST '<http://localhost:7700/indexes/movies/search>' \\
  -H 'Content-Type: application/json' \\
  --data-binary '{
    "q": "american ninja",
    "distinct": "genres"
  }'

Regarding the performance: using distinctAttribute or distinct is the same

https://github.com/meilisearch/meilisearch/pull/4693#issuecomment-2178084592

Telemetry

List all the new or updated telemetry

Name Description Example
e.g. infos.log_level e.g. “value of --log-level” e.g. “debug”
distinct Boolean indicating whether a distinct was specified in an aggregated list of requests. true

Error handling