Skip to main content
Each index you want to make available to conversational search must have its chat settings configured. These settings tell the LLM what the index contains, how to format document data, and what search parameters to use.

Update chat settings

Use the /indexes/{index_uid}/settings/chat endpoint to configure chat settings for an index:
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "description": "A movie database containing titles, overviews, genres, and release dates",
    "documentTemplate": "{% for field in fields %}{% if field.is_searchable and field.value != nil %}{{ field.name }}: {{ field.value }}\n{% endif %}{% endfor %}",
    "documentTemplateMaxBytes": 400
  }'

Settings reference

FieldTypeDefaultDescription
descriptionstring""Describes the index content to the LLM so it can decide when and how to query it
documentTemplatestringAll searchable fieldsLiquid template defining the text sent to the LLM for each document
documentTemplateMaxBytesinteger400Maximum size in bytes of the rendered document template. Longer text is truncated
searchParametersobject{}Search parameters applied when the LLM queries this index

Description

The description field is the most important setting. It tells the LLM what the index contains, so it can decide which index to search when answering a question. A well-written description significantly improves answer relevance. Write your description as if you were explaining the index to a person who has never seen your data:
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "description": "A movie database with titles, overviews, genres, release dates, and ratings. Use this index when the user asks about movies, films, actors, directors, or anything related to cinema."
  }'
If you have multiple indexes, make each description specific enough that the LLM can distinguish between them. For example:
  • movies index: “A movie database with titles, overviews, genres, and ratings”
  • actors index: “A database of actors with names, biographies, and filmographies”
  • reviews index: “User-submitted movie reviews with ratings and comments”

Document template

The documentTemplate field is a Liquid template that defines what data Meilisearch sends to the LLM for each matching document. By default, Meilisearch sends all searchable fields, which may not be ideal if your documents have many fields. A good document template includes only the fields relevant to answering questions:
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "documentTemplate": "Title: {{ doc.title }}\nGenres: {{ doc.genres | join: \", \" }}\nOverview: {{ doc.overview }}\nRelease date: {{ doc.release_date }}"
  }'
The documentTemplateMaxBytes field truncates the rendered template to a maximum size in bytes (default 400). This ensures a good balance between context quality and response speed. Increase this value if your documents contain long text fields that are important for answering questions. For more guidance, see the document template best practices article.

Search parameters

The searchParameters object controls how the LLM searches the index. This is useful for enabling hybrid search, limiting the number of results, or applying default sorting.
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "searchParameters": {
      "hybrid": {
        "embedder": "default",
        "semanticRatio": 0.5
      },
      "limit": 10,
      "attributesToSearchOn": ["title", "overview"]
    }
  }'

Available parameters

ParameterTypeDescription
hybridobjectEnable hybrid search with embedder (required) and semanticRatio (0.0 for keyword only, 1.0 for semantic only)
limitintegerMaximum number of documents returned per search
sortstring[]Sort order, e.g. ["price:asc", "rating:desc"]
distinctstringReturn at most one document per distinct value of this attribute
matchingStrategystringHow query terms are matched: last, all, or frequency
attributesToSearchOnstring[]Restrict search to specific attributes
rankingScoreThresholdnumberMinimum ranking score (0.0 to 1.0) for a document to be included
If you have configured embedders on your index, enable hybrid search in chat to combine keyword and semantic search:
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/movies/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "searchParameters": {
      "hybrid": {
        "embedder": "default",
        "semanticRatio": 0.7
      }
    }
  }'
A semanticRatio of 0.7 favors semantic search while still using keyword matching. Adjust this value based on your data and query patterns.

Retrieve current settings

Get the current chat settings for an index:
curl \
  -X GET 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY'

Reset settings

Reset chat settings to their defaults:
curl \
  -X DELETE 'MEILISEARCH_URL/indexes/INDEX_NAME/settings/chat' \
  -H 'Authorization: Bearer MEILISEARCH_KEY'

Next steps