Skip to content

update displayed_searchable_attributes.md #2132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -312,32 +312,28 @@ get_version_1: |-
-X GET 'http://localhost:7700/version'
distinct_attribute_guide_1: |-
curl \
-X PATCH 'http://localhost:7700/indexes/jackets/settings' \
-X PUT 'http://localhost:7700/indexes/jackets/settings/distinct-attribute' \
-H 'Content-Type: application/json' \
--data-binary '{ "distinctAttribute": "product_id" }'
--data-binary '"product_id"'
field_properties_guide_searchable_1: |-
curl \
-X PATCH 'http://localhost:7700/indexes/movies/settings' \
-X PUT 'http://localhost:7700/indexes/movies/settings/searchable-attributes' \
-H 'Content-Type: application/json' \
--data-binary '{
"searchableAttributes": [
--data-binary '[
"title",
"overview",
"genres"
]
}'
]'
field_properties_guide_displayed_1: |-
curl \
-X PATCH 'http://localhost:7700/indexes/movies/settings' \
-X PUT 'http://localhost:7700/indexes/movies/settings/displayed-attributes' \
-H 'Content-Type: application/json' \
--data-binary '{
"displayedAttributes": [
--data-binary '[
"title",
"overview",
"genres",
"release_date"
]
}'
]'
filtering_guide_1: |-
curl \
-X POST 'http://localhost:7700/indexes/movies/search' \
Expand Down
36 changes: 16 additions & 20 deletions learn/configuration/displayed_searchable_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@

By default, whenever a document is added to Meilisearch, all new attributes found in it are automatically added to two lists:

- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words
- [`displayedAttributes`](/learn/configuration/displayed_searchable_attributes.md#displayed-fields): Attributes whose fields are displayed in documents
- [`searchableAttributes`](/learn/configuration/displayed_searchable_attributes.md#the-searchableattributes-list): Attributes whose values are searched for matching query words

By default, every field in a document is **displayed** and **searchable**. These properties can be modified in the [settings](/reference/api/settings.md).

## Displayed fields

The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**.

Documents returned upon search contain only displayed fields. If a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents.

This means that by default, every field in a document is **searchable** and **displayed**. These properties can be modified in the [settings](/reference/api/settings.md).
**By default, all field attributes are set as displayed**.

#### Example

Suppose you manage a database that contains information about movies. By adding the following settings, documents returned upon search will contain the fields `title`, `overview`, `release_date` and `genres`.

<CodeSamples id="field_properties_guide_displayed_1" />

## Searchable fields

Expand Down Expand Up @@ -54,24 +68,6 @@ Suppose that you manage a database of movies with the following fields: `id`, `o

<CodeSamples id="field_properties_guide_searchable_1" />

## Displayed fields

The fields whose attributes are added to the [`displayedAttributes` list](/reference/api/settings.md#displayed-attributes) are **displayed in each matching document**.

Documents returned upon search contain only displayed fields.

**By default, all field attributes are set as displayed**.

Therefore, if a field attribute is not in the displayed-attribute list, the field won't be added to the returned documents.

This list can be restricted to a selected set of attributes in the settings.

#### Example

Suppose you manage a database that contains information about movies. By adding the following settings, documents returned upon search will contain the fields `title`, `overview`, `release_date` and `genres`.

<CodeSamples id="field_properties_guide_displayed_1" />

## Data storing

All fields are stored in the database. **This behavior cannot be changed**.
Expand Down