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.
NOTE
Updating the settings means overwriting the default settings of MeiliSearch. You can reset to default values using the DELETE
routes.
Learn more about displayed fields.
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
JavaScript
Python
PHP
Ruby
Go
Rust
curl \
-X GET 'http://localhost:7700/indexes/movies/settings/displayed-attributes'
client.index('movies').getDisplayedAttributes()
client.index('movies').get_displayed_attributes()
$client->index('movies')->getDisplayedAttributes();
client.index('movies').get_displayed_attributes
client.Index("movies").GetDisplayedAttributes()
let displayed_attributes: Vec<String> = movies.get_displayed_attributes().await.unwrap();
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.
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
JavaScript
Python
PHP
Ruby
Go
Rust
curl \
-X POST 'http://localhost:7700/indexes/movies/settings/displayed-attributes' \
--data '[
"title",
"description",
"genre",
"release_date"
]'
client.index('movies').updateDisplayedAttributes([
'title',
'description',
'genre',
'release_date',
])
client.index('movies').update_displayed_attributes([
'title',
'description',
'genre',
'release_date'
])
$client->index('movies')->updateDisplayedAttributes([
'title',
'description',
'genre',
'release_date'
]);
client.index('movies').update_displayed_attributes([
'title',
'description',
'genre',
'release_date'
])
displayedAttributes := []string{
"title",
"description",
"genre",
"release_date",
}
client.Index("movies").UpdateDisplayedAttributes(&displayedAttributes)
let displayed_attributes = [
"title",
"description",
"genre",
"release_date"
];
let progress: Progress = movies.set_displayed_attributes(&displayed_attributes).await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.
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
JavaScript
Python
PHP
Ruby
Go
Rust
curl \
-X DELETE 'http://localhost:7700/indexes/movies/settings/displayed-attributes'
client.index('movies').resetDisplayedAttributes()
client.index('movies').reset_displayed_attributes()
$client->index('movies')->resetDisplayedAttributes();
client.index('movies').reset_displayed_attributes
client.Index("movies").ResetDisplayedAttributes()
let progress: Progress = movies.reset_displayed_attributes().await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.