> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Searchable attributes

> How to decide which searchable attributes you want to use

export const Application = () => <Tooltip tip="An Algolia application is a self-contained environment with its own indices, configuration, and API keys. Applications don't share data or settings with each other.">
    application
  </Tooltip>;

export const AlgoliaSearch = () => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80" width="20" height="20" className="inline" fill="none" role="presentation" ariaLabel="Algolia Search">
    <circle cx="40" cy="32" r="28" fill="#5468FF"></circle>
    <rect x="30" y="22" width="20" height="20" rx="10" fill="#fff"></rect>
    <path d="M43 63.5 54.5 60l6 17h-12L43 63.5Z" fill="#36395A"></path>
  </svg>;

When setting up and configuring your index, decide which [attributes you want to use for searching](/doc/guides/sending-and-managing-data/prepare-your-data#algolia-records).
When you create an index, **all attributes in all your records are searchable by default**.
This means you can perform searches straight away without configuring anything.
However, to enhance search relevance and exclude unnecessary results,
you should specify which attributes should be searchable.

* An example of a useful searchable attribute is the name of a product.
* An example of an attribute that isn't useful for searching is a URL.
  Since users seldom search for URLs, exclude them from the searchable attributes list.
  However, you can still use image URLs to display images in the results.

For example, on a recipes website it makes sense to make `title`, `ingredients`, and `comments` searchable, and exclude `images`.
You can still use non-searchable attributes for display or filtering.

## Attributes to include

The following attributes are commonly included (searchable):

* Descriptive attributes: name, description, brand, list of actors in a film, list of features in a computer.
* Filters: color, brand, size.
* Keywords and tags.
* Valuable data like telephone numbers, SKU, ISBN, and other identifying attributes.

## Attributes to exclude

These are often excluded (not searchable):

* For display only: image and other URLs, price, brand logos, SKU.
* Short descriptions are meant to be displayed, not searched since they usually summarize what's in a longer description.
* For information only: not yet available, just released, on promotion.
* For ranking only: most sales, most viewed, highest rated.

## Set searchable attributes

Specify searchable attributes from the dashboard or API.

### Set searchable attributes in the Algolia dashboard

1. Go to the [Algolia dashboard](https://dashboard.algolia.com/explorer/browse) and select your Algolia <Application />.
2. On the left sidebar, select <AlgoliaSearch /> **Search**.
3. Select your Algolia index.
4. On the **Configuration** tab, select **Searchable attributes**.
5. Click **Add a Searchable Attribute** and type or select an attribute from the list.
6. Change the [order of attributes](/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way#attribute-order) by dragging them up or down in the **Searchable attributes** list.
   To make two attributes equally important, when you add a new attribute,
   type the attributes directly as a comma-separated list—for example, `title, comments`.
7. Save your changes.

### Set searchable attributes with the API

To make certain attributes searchable,
include them in the [`searchableAttributes`](/doc/api-reference/api-parameters/searchableAttributes) setting when configuring your index with the [`setSettings`](/doc/libraries/sdk/v1/methods/set-settings) method.

To configure [the order of searchable attributes](/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way#attribute-order):

* The higher in the list you place an attribute, the higher matches within that attribute will rank in search results.
* If you want two attributes to have the same priority, include them on the same level, separated by a comma.

In this example, matches in the title and comments attributes rank the same but also rank before matches in the ingredients attribute.
To run the code examples on this page, [install the latest API client](/doc/libraries/sdk/install).

<CodeGroup>
  ```cs C# theme={"system"}
  var response = await client.SetSettingsAsync(
    "INDEX_NAME",
    new IndexSettings
    {
      SearchableAttributes = new List<string> { "title,comments", "ingredients" },
    }
  );
  ```

  ```dart Dart theme={"system"}
  final response = await client.setSettings(
    indexName: "INDEX_NAME",
    indexSettings: IndexSettings(
      searchableAttributes: [
        "title,comments",
        "ingredients",
      ],
    ),
  );
  ```

  ```go Go theme={"system"}
  response, err := client.SetSettings(client.NewApiSetSettingsRequest(
    "INDEX_NAME",
    search.NewEmptyIndexSettings().SetSearchableAttributes(
      []string{"title,comments", "ingredients"})))
  if err != nil {
    // handle the eventual error
    panic(err)
  }
  ```

  ```java Java theme={"system"}
  UpdatedAtResponse response = client.setSettings(
    "INDEX_NAME",
    new IndexSettings().setSearchableAttributes(Arrays.asList("title,comments", "ingredients"))
  );
  ```

  ```js JavaScript theme={"system"}
  const response = await client.setSettings({
    indexName: 'theIndexName',
    indexSettings: { searchableAttributes: ['title,comments', 'ingredients'] },
  });
  ```

  ```kotlin Kotlin theme={"system"}
  var response =
    client.setSettings(
      indexName = "INDEX_NAME",
      indexSettings =
        IndexSettings(searchableAttributes = listOf("title,comments", "ingredients")),
    )
  ```

  ```php PHP theme={"system"}
  $response = $client->setSettings(
      'INDEX_NAME',
      ['searchableAttributes' => [
          'title,comments',

          'ingredients',
      ],
      ],
  );
  ```

  ```python Python theme={"system"}
  response = client.set_settings(
      index_name="INDEX_NAME",
      index_settings={
          "searchableAttributes": [
              "title,comments",
              "ingredients",
          ],
      },
  )
  ```

  ```ruby Ruby theme={"system"}
  response = client.set_settings(
    "INDEX_NAME",
    Algolia::Search::IndexSettings.new(searchable_attributes: ["title,comments", "ingredients"])
  )
  ```

  ```scala Scala theme={"system"}
  val response = Await.result(
    client.setSettings(
      indexName = "INDEX_NAME",
      indexSettings = IndexSettings(
        searchableAttributes = Some(Seq("title,comments", "ingredients"))
      )
    ),
    Duration(100, "sec")
  )
  ```

  ```swift Swift theme={"system"}
  let response = try await client.setSettings(
      indexName: "INDEX_NAME",
      indexSettings: IndexSettings(searchableAttributes: ["title,comments", "ingredients"])
  )
  ```
</CodeGroup>

## See also

* [Configuring searchable attributes the right way](/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way)
* [Records, attributes, and searchable attributes](/doc/guides/sending-and-managing-data/prepare-your-data#algolia-records)
* [User-restricted access to data](/doc/guides/security/api-keys/how-to/user-restricted-access-to-data)
* [Fuzzy search and fuzzy matching (blog)](https://www.algolia.com/blog/engineering/discover-what-fuzzy-search-is-with-fuzzy-matching/)
* [How search queries are processed (blog)](https://www.algolia.com/blog/product/what-is-a-search-query-and-how-is-it-processed-by-a-search-engine/)
