Loading

Index and search analysis

Elastic Stack Serverless

Text analysis occurs at two times:

Index time
When a document is indexed, any text field values are analyzed.
Search time

When running a full-text search on a text field, the query string (the text the user is searching for) is analyzed. Search time is also called query time.

For more details on text analysis at search time, refer to Text analysis during search.

The analyzer, or set of analysis rules, used at each time is called the index analyzer or search analyzer respectively.

In most cases, the same analyzer should be used at index and search time. This ensures the values and query strings for a field are changed into the same form of tokens. In turn, this ensures the tokens match as expected during a search.

While less common, it sometimes makes sense to use different analyzers at index and search time. To enable this, Elasticsearch allows you to specify a separate search analyzer.

Generally, a separate search analyzer should only be specified when using the same form of tokens for field values and query strings would create unexpected or irrelevant search matches.