Skip to main content
PUT
/
indexes
/
{index_uid}
/
settings
/
filterable-attributes
cURL
curl \
  -X PUT 'MEILISEARCH_URL/indexes/movies/settings/filterable-attributes' \
  -H 'Content-Type: application/json' \
  --data-binary '[
    "genres",
    "director",
    {
      "attributePatterns": ["*_ratings"],
      "features": {
        "facetSearch": false,
        "filter": {
          "equality": true,
          "comparison": false
        }
      }
    }
  ]'
client.index('movies')
.updateFilterableAttributes([
"genres",
{
attributePatterns: ["genre"],
features: {
facetSearch: true,
filter: { equality: true, comparison: false },
},
}
])
$client->index('movies')->updateFilterableAttributes([
'author',
[
'attributePatterns' => ['genres'],
'features' => [
'facetSearch' => true,
'filter' => [
'equality' => true,
'comparison' => false,
],
],
],
]);
client.index('movies').update_filterable_attributes([
'genres',
'director'
])
FilterableAttributesConfig genres = FilterableAttributesConfig.simple("genres");

FilterableAttributesFilter directorFilter = new FilterableAttributesFilter();
directorFilter.setEquality(true);
directorFilter.setComparison(false);

FilterableAttributesFeatures directorFeatures = new FilterableAttributesFeatures();
directorFeatures.setFacetSearch(true);
directorFeatures.setFilter(directorFilter);

FilterableAttributesConfig director = new FilterableAttributesConfig();
director.setAttributePatterns(new String[] {"director"});
director.setFeatures(directorFeatures);

// Update settings
client.index("movies").updateGranularFilterableAttributesSettings(
new FilterableAttributesConfig[] {genres, director});
client.index('movies').update_filterable_attributes([
'genres',
'director'
])
filterableAttributes := []interface{}{
"genres",
"director",
AttributeRule{
AttributePatterns: []string{"tag"}
Features: AttributeFeatures{
FacetSearch: false,
Filter: FilterFeatures{
Equality: true,
Comparison: false,
}
}
},
map[string]interface{}{
"attributePatterns": []interface{}{"year"}
"features": map[string]interface{}{
"facetSearch": false,
"filter": map[string]interface{}{
"equality": true,
"comparison": true,
}
}
}
}
client.Index("movies").UpdateFilterableAttributes(&filterableAttributes)
var attributes = new FilterableAttribute[]
{
"director",
new FilterableAttribute
{
AttributePatterns = new[] { "genres" },
Features = new FilterableAttributeFeatures
{
FacetSearch = true,
Filter = new FilterableAttributeFilterFeatures
{
Equality = true,
Comparison = true,
},
},
},
};
TaskInfo result = await client.Index("movies").UpdateFilterableAttributesAsync(attributes);
use meilisearch_sdk::settings::{
FilterableAttribute,
FilterableAttributesSettings,
FilterFeatures,
FilterFeatureModes,
};

// Mixed legacy + new syntax
let filterable_attributes: Vec<FilterableAttribute> = vec![
// legacy: plain attribute name
"author".into(),
// new syntax: settings object
FilterableAttribute::Settings(FilterableAttributesSettings {
attribute_patterns: vec!["genre".to_string()],
features: FilterFeatures {
facet_search: true,
filter: FilterFeatureModes { equality: true, comparison: false },
},
}),
];

let task: TaskInfo = client
.index("movies")
.set_filterable_attributes_advanced(filterable_attributes)
.await
.unwrap();
await client
.index('movies')
.updateFilterableAttributes(['genres', 'director']);
client.index("movies").updateFilterableAttributes(["genre", "director"]) { (result) in
switch result {
case .success(let task):
print(task)
case .failure(let error):
print(error)
}
}
{
  "taskUid": 147,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "settingsUpdate",
  "enqueuedAt": "2024-08-08T17:05:55.791772Z"
}
{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}
{
"message": "Index `movies` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"
}

Authorizations

Authorization
string
header
required

An API key is a token that you provide when making API calls. Read more about how to secure your project.

Include the API key to the Authorization header, for instance:

-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'

If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:

const client = new MeiliSearch({
host: 'MEILISEARCH_URL',
apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1'
});

Path Parameters

index_uid
string
required

Unique identifier of the index.

Body

application/json

Response

Task successfully enqueued.

A summarized view of a task, returned when a task is enqueued

taskUid
integer<u-int32>
required

Unique sequential identifier of the task.

Required range: x >= 0
status
enum<string>
required

Status of the task. Possible values are enqueued, processing, succeeded, failed, and canceled.

Available options:
enqueued,
processing,
succeeded,
failed,
canceled
Example:

"processing"

type
enum<string>
required

Type of operation performed by the task.

Available options:
documentAdditionOrUpdate,
documentEdition,
documentDeletion,
settingsUpdate,
indexCreation,
indexDeletion,
indexUpdate,
indexSwap,
taskCancelation,
taskDeletion,
dumpCreation,
snapshotCreation,
export,
upgradeDatabase,
indexCompaction,
networkTopologyChange
Example:

"documentAdditionOrUpdate"

enqueuedAt
string<date-time>
required

Date and time when the task was enqueued.

indexUid
string | null

Unique identifier of the targeted index. Null for global tasks.

customMetadata
string | null

Custom metadata attached to this task at creation. Use it to associate tasks with external systems or add application-specific information.