0Pricing
Elasticsearch & Full Text Search Systems · Lección

Sinónimos y stemming

Mejore la recuperación en búsquedas de texto completo enseñando a Elasticsearch las variantes y equivalencias de las palabras mediante filtros de tokens de stemming y de sinónimos.

Sinónimos y stemming es una lección gratuita de Elasticsearch & Full Text Search Systems en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Elasticsearch & Full Text Search Systems, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Elasticsearch & Full Text Search Systems incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

Closing the Vocabulary Gap

Users rarely type the exact words stored in your documents. They search running but your text says run, or they type laptop when the doc says notebook. Two analysis techniques bridge this gap: stemming and synonyms.

What Stemming Does

Stemming reduces words to a common root form. running, runs, and ran may all become run. This means a query matches regardless of the grammatical form used.

Algorithmic Stemmers

Elasticsearch ships algorithmic stemmers like porter_stem and the language-aware stemmer filter. They apply rules to strip suffixes quickly without a dictionary.

"filter": {
  "my_stemmer": {
    "type": "stemmer",
    "language": "english"
  }
}

Dictionary Stemmers

Dictionary stemmers such as hunspell use real word lists for more accurate, linguistically correct roots. They are slower and need dictionary files but avoid over-stemming.

Over- and Under-Stemming

Stemming has failure modes:

  • Over-stemming: unrelated words map to the same root (e.g. universe and university).
  • Under-stemming: related words fail to share a root.

Use keyword_marker to protect specific words from stemming.

What Synonyms Do

Synonyms map words with the same meaning to each other. Searching tv can match television. They are applied via a synonym token filter in the analyzer chain.

"filter": {
  "my_synonyms": {
    "type": "synonym",
    "synonyms": [ "tv, television", "laptop, notebook" ]
  }
}

Equivalent vs Explicit

Synonym rules come in two styles:

  • Equivalent (tv, television): all terms are interchangeable.
  • Explicit (i-pod => ipod, music player): the left maps to the right only.

Index-Time vs Search-Time

Synonyms can be applied when indexing or when searching. Search-time synonyms (via synonym_graph) are preferred because you can update the list without re-indexing the whole corpus.

"filter": {
  "graph_syns": {
    "type": "synonym_graph",
    "synonyms_path": "analysis/synonyms.txt"
  }
}

Multi-Word Synonyms

Multi-word synonyms like ny, new york need the graph-aware synonym_graph filter at search time to be tokenized correctly. The older synonym filter mishandles phrases.

Combining Both

A typical chain applies synonyms first, then stemming, after lowercasing. Order matters: stem after expanding synonyms so all variants get normalized consistently.

"my_analyzer": {
  "tokenizer": "standard",
  "filter": [ "lowercase", "graph_syns", "my_stemmer" ]
}

Testing With _analyze

Always verify your chain with the _analyze API to confirm the produced tokens match your expectations before relying on it in production.

GET my_index/_analyze
{
  "analyzer": "my_analyzer",
  "text": "running televisions"
}

Quick Check

Test your understanding of recall-boosting filters.

Recap

You learned to widen search recall:

  • Stemming reduces word forms to a shared root; watch for over/under-stemming.
  • Synonyms map equivalent terms; equivalent vs explicit rules behave differently.
  • Prefer synonym_graph at search time for editable, multi-word-safe synonyms.
  • Verify analyzer output with the _analyze API.

Preguntas frecuentes

¿La lección «Sinónimos y stemming» es gratis?

Sí — el texto completo de «Sinónimos y stemming» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Elasticsearch & Full Text Search Systems, actualiza a CoddyKit PRO. El curso de Elasticsearch & Full Text Search Systems incluye 4 lecciones en total.

¿Qué aprenderé en «Sinónimos y stemming»?

Mejore la recuperación en búsquedas de texto completo enseñando a Elasticsearch las variantes y equivalencias de las palabras mediante filtros de tokens de stemming y de sinónimos. Practicas Elasticsearch & Full Text Search Systems con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Elasticsearch & Full Text Search Systems?

No se requiere experiencia previa. Elasticsearch & Full Text Search Systems en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Sinónimos y stemming»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Elasticsearch & Full Text Search Systems?

Sí. Cada lección de Elasticsearch & Full Text Search Systems incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Analizadores, tokenizadores y filtros
  2. Personalización de analizadores de texto
  3. Boosting y cálculo de relevancia
  4. Sinónimos y stemming
← Volver a Elasticsearch & Full Text Search Systems