Filterable attributes
Child route of the settings route.
Attributes that can be used as filters for filtering and faceted search. You can learn more about filtering and faceted search in our dedicated guide.
Filterable attributes can also be updated through the global settings route.
Get filterable attributes
GET
/indexes/:index_uid/settings/filterable-attributes
Get an index’s filterableAttributes
.
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/filterable-attributes'
client.index('movies').getFilterableAttributes()
client.index('movies').get_filterable_attributes()
$client->index('movies')->getFilterableAttributes();
client.index('movies').filterable_attributes
client.Index("movies").GetFilterableAttributes()
let filterable_attributes: Vec<String> = movies.get_filterable_attributes().await.unwrap();
Response: 200 Ok
List the settings.
["genres", "director"]
Update filterable attributes
POST
/indexes/:index_uid/settings/filterable-attributes
Update an index’s filterable attributes list. This will re-index all documents in the index.
Path variables
Variable | Description |
---|---|
index_uid | The index UID |
Body
An array of strings containing the attributes that can be used as filters at query time.
You can read more about this setting at the feature reference page.
Example
cURL
JavaScript
Python
PHP
Ruby
Go
Rust
curl \
-X POST 'http://localhost:7700/indexes/movies/settings/filterable-attributes' \
--data '[
"genres",
"director"
]'
client.index('movies')
.updateFilterableAttributes([
'genres',
'director'
])
client.index('movies').update_filterable_attributes([
'genres',
'director'
])
$client->index('movies')->updateFilterableAttributes([
'genres',
'director'
]);
client.index('movies').update_filterable_attributes([
'genres',
'director'
])
filterableAttributes := []string{
"genres",
"director",
}
client.Index("movies").UpdateFilterableAttributes(&filterableAttributes)
let filterable_attributes = [
"genres",
"director"
];
let progress: Progress = movies.set_filterable_attributes(&filterable_attributes).await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.
Reset filterable attributes
DELETE
/indexes/:index_uid/settings/filterable-attributes
Reset an index’s filterable attributes list back to its default value.
Default value
An empty array ([]
).
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/filterable-attributes'
client.index('movies').resetFilterableAttributes()
client.index('movies').reset_filterable_attributes()
$client->index('movies')->resetFilterableAttributes();
client.index('movies').reset_filterable_attributes
client.Index("movies").ResetFilterableAttributes()
let progress: Progress = movies.reset_filterable_attributes().await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.