# Distinct attribute

Child route of the settings route.

Distinct attribute is a field whose value will always be unique in the returned documents.

Distinct attribute can also be updated directly through the global settings route along with the other settings.

To learn more about distinct attributes, refer to our dedicated guide.

WARNING

Updating the settings means overwriting the default settings of MeiliSearch. You can reset to default values using the DELETE routes.

# Get distinct attribute

GET
/indexes/:index_uid/settings/distinct-attribute

Get the distinct attribute field of an index.

# Path variables

Variable Description
index_uid The index UID

# Example

curl \
  -X GET 'http://localhost:7700/indexes/shoes/settings/distinct-attribute'

# Response: 200 Ok

"skuid"

# Update distinct attribute

POST
/indexes/:index_uid/settings/distinct-attribute

Update the distinct attribute field of an index.

# Path variables

Variable Description
index_uid The index UID

# Body

A String: the field name.

More information about the body.

WARNING

If the field does not exist, no error will be thrown.

# Example

curl \
  -X POST 'http://localhost:7700/indexes/shoes/settings/distinct-attribute' \
  -H 'Content-Type: application/json' \
  --data-binary '"skuid"'

# Response: 202 Accepted

{
    "uid": 1,
    "indexUid": "movies",
    "status": "enqueued",
    "type": "settingsUpdate",
    "enqueuedAt": "2021-08-11T09:25:53.000000Z"
}

You can use this uid to get more details on the status of the task.

# Reset distinct attribute

DELETE
/indexes/:index_uid/settings/distinct-attribute

Reset the distinct attribute field of an index to its default value.

Default value: null

# Path variables

Variable Description
index_uid The index UID

# Example

curl \
  -X DELETE 'http://localhost:7700/indexes/shoes/settings/distinct-attribute'

# Response: 202 Accepted

{
    "uid": 1,
    "indexUid": "movies",
    "status": "enqueued",
    "type": "settingsUpdate",
    "enqueuedAt": "2021-08-11T09:25:53.000000Z"
}

You can use this uid to get more details on the status of the task.