# Searchable attributes

Child route of the settings route.

The values of the fields whose attributes are added to the searchable-attributes list are searched for matching query words.

Searchable attributes can also be updated directly through the global settings route at the same time than 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 searchable fields

# Get searchable attributes

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

Get the searchable attributes of an index.

# Path Variables

Variable Description
index_uid The index UID

# Example

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

# Response: 200 Ok

List the settings.

["title", "description", "uid"]

# Update searchable attributes

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

Update the searchable attributes of an index.

# Path Variables

Variable Description
index_uid The index UID

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

# Examples

$ curl \
  -X GET 'http://localhost:7700/indexes/movies/settings/searchable-attributes' \
  --data '[
      "title",
      "description",
      "uid"
  ]'

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

# Response: 202 Accepted

{
  "updateId": 1
}

This updateId allows you to track the current update.

# Reset searchable attributes

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

Reset the searchable 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/searchable-attributes'

# Response: 202 Accepted

{
  "updateId": 1
}

This updateId allows you to track the current update.