# Displayed attributes

Child route of the settings route.

The fields whose attributes are added to the displayed-attributes list are displayed in each matching document.
By default, all fields are considered to be displayedAttributes. This behavior is represented by the * in the settings. Setting displayedAttributes to an empty array [] will reset the setting to its default value.

Displayed attributes can also be updated directly through the global settings route along with the other settings.

To learn more about displayed 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 displayed attributes

GET
/indexes/:index_uid/settings/displayed-attributes

Get the displayed attributes of an index.

# Path variables

Variable Description
index_uid The index UID

# Example

curl \
  -X GET 'http://localhost:7700/indexes/movies/settings/displayed-attributes'

# Response: 200 Ok

List the settings.

[
  "title",
  "description",
  "genre",
  "release_date"
]

# Update displayed attributes

POST
/indexes/:index_uid/settings/displayed-attributes

Update the displayed attributes of an index.

NOTE

displayedAttributes only impacts search results. It has no effect on other methods of retrieving or copying documents, such as the GET documents endpoint, dumps, or snapshots.

# Path variables

Variable Description
index_uid The index UID

# Body

An array of strings that contains attributes of an index to display.

More information about the body.

# Example

curl \
  -X POST 'http://localhost:7700/indexes/movies/settings/displayed-attributes' \
  -H 'Content-Type: application/json' \
  --data-binary '[
      "title",
      "description",
      "genre",
      "release_date"
  ]'

# 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 displayed attributes

DELETE
/indexes/:index_uid/settings/displayed-attributes

Reset the displayed attributes of the index to the default value.

# Default value

All attributes found in the documents added to the index.

# Path variables

Variable Description
index_uid The index UID

# Example

curl \
  -X DELETE 'http://localhost:7700/indexes/movies/settings/displayed-attributes'

# 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.