Full text search
Build a named search index in memory from JSON rows or texts, then query it with BM25 ranking, field filters and fuzzy or prefix matching. Typical uses: search a product catalog, a knowledge base or a list of tickets.
text search_indextext search_indextext search_querytext search_querytext search_listtext search_listtext search_droptext search_drop

text search_index <name> <json_documents>


Description

    Build a named index from a JSON array of rows (objects) or of texts (field text). The indexed fields are by default the text fields of the rows (not id), the id is the field id, or the position (0, 1...). Result: {name, documents, terms, fields, lang, stem, stopwords, bytes_estimate, created, last_used, idle_timeout_s}

Parameters

    name:   The name of the index: 1 to 64 characters among A-Z a-z 0-9 _ . - - String - required
    json_documents:   The rows or texts, as a JSON array - String - required
admin
text search_index "doc_faq" "[{\"id\": \"Q1\", \"title\": \"Réinitialiser le mot de passe\", \"body\": \"Cliquez sur Mot de passe oublié : un lien de réinitialisation arrive par e-mail.\", \"cat\": \"compte\", \"year\": 2024}, {\"id\": \"Q2\", \"title\": \"Facture introuvable\", \"body\": \"Les factures sont dans l'espace client, rubrique Paiements. Une facture payée par carte arrive sous 24 heures.\", \"cat\": \"paiement\", \"year\": 2025}, {\"id\": \"Q3\", \"title\": \"Changer de carte bancaire\", \"body\": \"Dans Paiements, choisissez Modifier la carte. Les paiements suivants utilisent la nouvelle carte.\", \"cat\": \"paiement\", \"year\": 2023}, {\"id\": \"Q4\", \"title\": \"Supprimer mon compte\", \"body\": \"Le compte et ses données sont supprimés 30 jours après la demande.\", \"cat\": \"compte\", \"year\": 2025}]"
mentdb
{"name": "doc_faq", "documents": 4, "terms": 33, "fields": ["title", "body", "cat"], "lang": "fr", "stem": true, "stopwords": true, "bytes_estimate": 9454, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.690Z", "idle_timeout_s": 3600}

text search_index <name> <json_documents> <json_params>


Description

    Build an index with parameters: fields (the fields to index), id_field (id), lang (fr, en, none), stem (true), stopwords (true), boosts ({"title": 2}: weight of a field, 0.01 to 100), store (true: the whole row is kept and returned; false: only the indexed fields), append (false: true adds the rows to the index of this name, with the settings it was built with; an id already there is an error), idle_timeout_s (3600, 10 to 604800)

Parameters

    name:   The name of the index - String - required
    json_documents:   The rows or texts - String - required
    json_params:   The parameters, as a JSON object - String - required
admin
text search_index "doc_faq" "[{\"id\": \"Q1\", \"title\": \"Réinitialiser le mot de passe\", \"body\": \"Cliquez sur Mot de passe oublié : un lien de réinitialisation arrive par e-mail.\", \"cat\": \"compte\", \"year\": 2024}, {\"id\": \"Q2\", \"title\": \"Facture introuvable\", \"body\": \"Les factures sont dans l'espace client, rubrique Paiements. Une facture payée par carte arrive sous 24 heures.\", \"cat\": \"paiement\", \"year\": 2025}, {\"id\": \"Q3\", \"title\": \"Changer de carte bancaire\", \"body\": \"Dans Paiements, choisissez Modifier la carte. Les paiements suivants utilisent la nouvelle carte.\", \"cat\": \"paiement\", \"year\": 2023}, {\"id\": \"Q4\", \"title\": \"Supprimer mon compte\", \"body\": \"Le compte et ses données sont supprimés 30 jours après la demande.\", \"cat\": \"compte\", \"year\": 2025}]" "{\"fields\": [\"title\", \"body\"], \"boosts\": {\"title\": 2}}"
mentdb
{"name": "doc_faq", "documents": 4, "terms": 33, "fields": ["title", "body"], "lang": "fr", "stem": true, "stopwords": true, "bytes_estimate": 9198, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.690Z", "idle_timeout_s": 3600}
Add one row
admin
text search_index "doc_faq" "[{\"id\": \"Q5\", \"title\": \"Payer par virement\", \"body\": \"Le virement est possible pour les factures de plus de 500 euros.\", \"cat\": \"paiement\", \"year\": 2026}]" "{\"append\": true}"
mentdb
{"name": "doc_faq", "documents": 5, "terms": 38, "fields": ["title", "body"], "lang": "fr", "stem": true, "stopwords": true, "bytes_estimate": 10962, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.690Z", "idle_timeout_s": 3600}
English texts
admin
text search_index "doc_en" "[\"The running dogs are barking\", \"A dog runs fast\", \"Cats sleep all day\"]" "{\"lang\": \"en\"}"
mentdb
{"name": "doc_en", "documents": 3, "terms": 7, "fields": ["text"], "lang": "en", "stem": true, "stopwords": true, "bytes_estimate": 2044, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.690Z", "idle_timeout_s": 3600}
Used in use cases (1 recipe)

    Conversational bot designer › Answer the questions of a support bot from a FAQ, with typos and highlighted answers
Often used with

    text search_drop  ·  text search_query

text search_query <name> <query>


Description

    Search an index: JSON {index, query_terms (after the analysis), total (rows found), results: [{id, score, row, snippets: {field: text}}]}, the 10 best rows, a row has at least one word of the query

Parameters

    name:   The name of the index - String - required
    query:   The words to find; -word excludes a word - String - required
admin
text search_query "doc_faq" "payer facture carte"
mentdb
{"index": "doc_faq", "query_terms": ["payer", "factur", "carte"], "total": 3, "results": [{"id": "Q5", "score": 3.034011, "row": {"id": "Q5", "title": "Payer par virement", "body": "Le virement est possible pour les factures de plus de 500 euros.", "cat": "paiement", "year": 2026}, "snippets": {"title": "<mark>Payer</mark> par virement", "body": "Le virement est possible pour les <mark>factures</mark> de plus de 500 euros."}}, {"id": "Q2", "score": 2.227087, "row": {"id": "Q2", "title": "Facture introuvable", "body": "Les factures sont dans l'espace client, rubrique Paiements. Une facture payée par carte arrive sous 24 heures.", "cat": "paiement", "year": 2025}, "snippets": {"title": "<mark>Facture</mark> introuvable", "body": "Les <mark>factures</mark> sont dans l'espace client, rubrique Paiements. Une <mark>facture</mark> payée par <mark>carte</mark> arrive sous 24 heures."}}, {"id": "Q3", "score": 1.435612, "row": {"id": "Q3", "title": "Changer de carte bancaire", "body": "Dans Paiements, choisissez Modifier la carte. Les paiements suivants utilisent la nouvelle carte.", "cat": "paiement", "year": 2023}, "snippets": {"title": "Changer de <mark>carte</mark> bancaire", "body": "Dans Paiements, choisissez Modifier la <mark>carte</mark>. Les paiements suivants utilisent la nouvelle <mark>carte</mark>."}}]}
The stemming finds run and dogs
admin
text search_query "doc_en" "run dog"
mentdb
{"index": "doc_en", "query_terms": ["run", "dog"], "total": 2, "results": [{"id": 0, "score": 0.940007, "row": {"text": "The running dogs are barking"}, "snippets": {"text": "The <mark>running</mark> <mark>dogs</mark> are barking"}}, {"id": 1, "score": 0.940007, "row": {"text": "A dog runs fast"}, "snippets": {"text": "A <mark>dog</mark> <mark>runs</mark> fast"}}]}

text search_query <name> <query> <json_params>


Description

    Search with parameters: limit (10, 1000 at most), offset (0), operator (or; and: every word of the query), fields (search in these fields only), filters ({"field": value, "field": [values], "field": {"eq", "ne", "gt", "gte", "lt", "lte", "exists", "contains": value}}: on the stored rows, numbers compared as numbers), fuzzy (0, 1, 2 or auto: 0 up to 3 letters, 1 up to 7, then 2), prefix (false: true completes the last word, for a search as you type), k1 (1.2), b (0.75), min_score (0), return (row or id), snippet_fields, snippet_length (160), pre_tag (), post_tag (), escape_html (true). An empty query (or only -words) gives every row that passes the filters, score 0

Parameters

    name:   The name of the index - String - required
    query:   The words to find - String - required
    json_params:   The parameters, as a JSON object - String - required
admin
text search_query "doc_faq" "paiement" "{\"filters\": {\"year\": {\"gte\": 2025}}, \"return\": \"id\"}"
mentdb
{"index": "doc_faq", "query_terms": ["paiement"], "total": 1, "results": [{"id": "Q2", "score": 0.759027, "snippets": {"body": "Les factures sont dans l'espace client, rubrique <mark>Paiements</mark>. Une facture payée par carte arrive sous 24 heures."}}]}
A typo corrected by fuzzy
admin
text search_query "doc_faq" "factre" "{\"fuzzy\": \"auto\", \"return\": \"id\", \"limit\": 2}"
mentdb
{"index": "doc_faq", "query_terms": ["factr"], "total": 2, "results": [{"id": "Q2", "score": 0.73403, "snippets": {"title": "<mark>Facture</mark> introuvable", "body": "Les <mark>factures</mark> sont dans l'espace client, rubrique Paiements. Une <mark>facture</mark> payée par carte arrive sous 24 heures."}}, {"id": "Q5", "score": 0.517055, "snippets": {"body": "Le virement est possible pour les <mark>factures</mark> de plus de 500 euros."}}]}
Search as you type
admin
text search_query "doc_faq" "virem" "{\"prefix\": true, \"return\": \"id\", \"snippet_fields\": [\"body\"], \"pre_tag\": \"[\", \"post_tag\": \"]\"}"
mentdb
{"index": "doc_faq", "query_terms": ["virem"], "total": 1, "results": [{"id": "Q5", "score": 2.069484, "snippets": {"body": "Le [virement] est possible pour les factures de plus de 500 euros."}}]}
Exclude a word, every word required
admin
text search_query "doc_faq" "compte -mot" "{\"operator\": \"and\", \"return\": \"id\"}"
mentdb
{"index": "doc_faq", "query_terms": ["compt", "-mot"], "total": 1, "results": [{"id": "Q4", "score": 2.252356, "snippets": {"title": "Supprimer mon <mark>compte</mark>", "body": "Le <mark>compte</mark> et ses données sont supprimés 30 jours après la demande."}}]}
Used in use cases (1 recipe)

    Conversational bot designer › Answer the questions of a support bot from a FAQ, with typos and highlighted answers
Often used with

    text search_drop  ·  text search_index

text search_list


Description

    The indexes of the current user: a JSON array of the same objects as text search_index gives

admin
text search_list
mentdb
[{"name": "doc_faq", "documents": 5, "terms": 38, "fields": ["title", "body"], "lang": "fr", "stem": true, "stopwords": true, "bytes_estimate": 10962, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.691Z", "idle_timeout_s": 3600}, {"name": "doc_en", "documents": 3, "terms": 7, "fields": ["text"], "lang": "en", "stem": true, "stopwords": true, "bytes_estimate": 2044, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.691Z", "idle_timeout_s": 3600}]

text search_list <name>


Description

    One index of the current user

Parameters

    name:   The name of the index - String - required
admin
text search_list "doc_en"
mentdb
{"name": "doc_en", "documents": 3, "terms": 7, "fields": ["text"], "lang": "en", "stem": true, "stopwords": true, "bytes_estimate": 2044, "created": "2026-11-19T09:11:55.690Z", "last_used": "2026-11-19T09:11:55.692Z", "idle_timeout_s": 3600}

text search_drop <name>


Description

    Drop an index of the current user: {name, dropped}

Parameters

    name:   The name of the index - String - required
admin
text search_drop "doc_en"
mentdb
{"name": "doc_en", "dropped": true}

text search_drop


Description

    Drop all the indexes of the current user: {dropped: number}

admin
text search_drop
mentdb
{"dropped": 1}
Used in use cases (1 recipe)

    Conversational bot designer › Answer the questions of a support bot from a FAQ, with typos and highlighted answers
Often used with

    text search_index  ·  text search_query