# Searchable attributes

Child route of the settings route.

The values associated with attributes in the searchableAttributes list are searched for matching query words. The order of the list also determines the attribute ranking order.

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

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

GET
/indexes/{index_uid}/settings/searchable-attributes

Get the searchable attributes of an index. The index uid is required.

# Example

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

# Response: 200 Ok

List the settings.

[
  "title",
  "overview",
  "genres",
  "release_date.year"
]

# Update searchable attributes

POST
/indexes/{index_uid}/settings/searchable-attributes

Update the searchable attributes of an index. This will re-index all documents in the index. The index uid is required.

If an attribute contains an object, you can use dot notation to set one or more of its keys as a value for this setting: "searchableAttributes": ["release_date.year"].

WARNING

Due to an implementation bug, manually updating searchableAttributes will change the displayed order of document fields in the JSON response. This behavior is inconsistent and will be fixed in a future release.

# Body

An array of strings that contains searchable attributes sorted by order of importance (arranged from the most important attribute to the least important attribute).

This means that a document with a match in an attribute at the start of the array will be considered more relevant than a document with a match in an attribute at the end of the array.

More information about the body.

# Example

curl \
  -X POST 'http://localhost:7700/indexes/movies/settings/searchable-attributes' \
  -H 'Content-Type: application/json' \
  --data-binary '[
    "title",
    "overview",
    "genres"
  ]'

A match in title will make a document more relevant than another document with a match in overview.

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

DELETE
/indexes/{index_uid}/settings/searchable-attributes

Reset the searchable attributes of the index to the default value. The index uid is required.

# Default value

All attributes found in the documents added to the index.

# Example

curl \
  -X DELETE 'http://localhost:7700/indexes/movies/settings/searchable-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.