API Reference / API Parameters / attributeForDistinct
Type: string
Engine default: null
Parameter syntax
'attributeForDistinct' => 'attribute'

Can be used in these methods:

About this parameter

Name of the de-duplication attribute to be used with the distinct feature.

Usage notes

  • You can define only one attribute for distinct.
  • You must define it at indexing time. You can’t define or override it at query time.
  • Distinct values are expected to be strings or numbers:
    • boolean or null values aren’t grouped.
    • number values are rounded to the nearest integer and converted to their string representation, for example, 1 and 1.2 both turn into "1".
    • string values are used as they are.
    • array and object values aren’t supported and result in unspecified behavior.


Set the attribute to distinct on

  'attributeForDistinct' => 'url'
Did you find this page helpful?