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.

  • It must be done at indexing time; it cannot be defined or overridden at query time.

Examples

Set the attribute to distinct on

1
2
3
$index->setSettings([
  'attributeForDistinct' => 'url'
]);

Did you find this page helpful?