Scrivio Interview library
ConceptFoundations5 min read · updated 12 November 2026

What does an analyzer do in Elasticsearch? Describe character filters, tokenizers and token filters, and what the standard analyzer produces for 'The Quick-Brown Foxes!'.

An analyzer turns text into the terms stored in the inverted index, at index time, and turns the query text into terms the same way at search time. It runs in three stages: character filters clean the raw text, a tokenizer splits it into tokens, and token filters change, remove or add tokens, for example lowercasing, removing stop words or stemming. The standard analyzer turns 'The Quick-Brown Foxes!' into the, quick, brown and foxes; the english analyzer would give quick, brown and fox.

Why this question is asked

Most surprising search behaviour, a query that does not match what looks like identical text, or a match that seems unrelated, comes from analysis. The analyzer decides what words exist in the index, so it decides what can ever be found. Interviewers ask about it early because it is the foundation for mappings, relevance and debugging. In this answer, we will see where analysis happens, go through the three stages, run the standard analyzer on the example, compare it with the english analyzer, and use the _analyze API to check our expectations.

1Where Analysis Happens

In Elasticsearch and OpenSearch, a field of type text is analysed. When a document is indexed, the field's analyzer turns its value into terms, and those terms go into the inverted index. When a full-text query such as match runs against that field, the query string goes through the same analyzer, by default, so the query's terms are comparable with the indexed terms.

That symmetry is the point. If the index stores 'quick' and the user types 'Quick', both sides lowercase it, and the terms match. A keyword field, by contrast, is not analysed: the whole value is one term, exactly as written, which is right for ids and codes but not for prose.

2The Three Stages of an Analyzer

Every analyzer is a pipeline with a fixed order. Character filters come first and see the raw string. They can strip HTML tags with html_strip, or map characters, such as turning '&' into 'and'. There can be zero or more of them.

Then exactly one tokenizer splits the text into tokens and records each token's position and character offsets. The standard tokenizer follows Unicode word-boundary rules, so it splits on spaces and most punctuation. Other tokenizers split only on whitespace, or produce n-grams, or handle languages without spaces.

Finally, token filters process the stream of tokens in order. lowercase lowercases them, stop removes common words like 'the', stemmers such as porter_stem reduce words to a root form, synonym adds alternative terms, and asciifolding turns U+00E9 into a plain e.

Step throughHow an analyzer processes text
  1. Raw textThe Quick-Brown Foxes!
  2. Character filters (0 or more)standard analyzer: none
  3. Tokenizer (exactly 1)standard: The | Quick | Brown | Foxes
  4. Token filters (0 or more)lowercase
  5. Terms in the indexthe, quick, brown, foxes

5 steps in order. Play them, or step through them one at a time.

3Running the Standard Analyzer on the Example

The standard analyzer is the default for text fields. It has no character filters, uses the standard tokenizer, and applies the lowercase filter. It also has a stop word filter, but its stop word list is empty by default, so no words are removed. The _analyze API lets us see the result directly.

Java
POST /_analyze
{ "analyzer": "standard", "text": "The Quick-Brown Foxes!" }
// tokens:
// "the" position 0
// "quick" position 1
// "brown" position 2
// "foxes" position 3

Notice three things. The hyphen split 'Quick-Brown' into two tokens, because the standard tokenizer treats it as a word boundary. The exclamation mark disappeared, because punctuation is not part of a token. And 'foxes' stayed plural, because the standard analyzer does no stemming. So a search for 'fox' would not match this document through a standard-analysed field, while 'Foxes' or 'FOXES' would.

4What the English Analyzer Changes

Language analyzers add language knowledge. The english analyzer uses the same standard tokenizer, then applies, among others, a filter for English possessives, lowercase, English stop words and an English stemmer.

Java
POST /_analyze
{ "analyzer": "english", "text": "The Quick-Brown Foxes!" }
// tokens:
// "quick" position 1
// "brown" position 2
// "fox" position 3
// ("the" was removed as a stop word; position 0 is left empty)

Now 'the' is gone and 'foxes' is stemmed to 'fox', so queries for 'fox', 'foxes' or even 'Fox' all match. Notice the positions: the removed stop word leaves a gap, which keeps phrase queries honest about distances. The trade-off is precision. Stemming can merge words with different meanings, and removing stop words makes some phrases like 'to be or not to be' unsearchable, so the choice depends on the content.

5Checking Analyzers With the _analyze API

The _analyze API is the first tool for any analysis question. Besides named analyzers, it accepts a field, which runs that field's configured analyzer, or an ad hoc combination of tokenizer and filters, which is how we try out a custom analyzer before creating an index.

Java
POST /products/_analyze
{ "field": "title", "text": "Wi-Fi 6 Router" }
// uses the analyzer mapped on products.title
POST /_analyze
{ "char_filter": ["html_strip"], "tokenizer": "standard",
"filter": ["lowercase", "asciifolding"],
"text": "<b>Crème</b> Brûlée" }
// "creme", "brulee"

Comparing the output for the indexed text and the query text usually explains a missing match in seconds: if the two lists have no term in common, the document cannot match.

6Follow-up questions

Can the search-time analyzer differ from the index-time analyzer?

Yes, with search_analyzer in the mapping. A common case is autocomplete: index with an edge n-gram filter so 'wireless' is stored as 'w', 'wi', 'wir' and so on, but search with the standard analyzer so the query is not split into n-grams too.

Does changing an analyzer affect existing documents?

No. Indexed terms are already in the inverted index. To apply a new analyzer to existing data we create a new index with the new mapping and reindex.

Why does the standard analyzer not remove stop words?

Modern scoring with BM25 already gives very common words little weight, and removing them breaks phrase searches and queries made only of common words. So the default keeps them; language analyzers remove them.

7Conclusion

In this answer, we saw that an analyzer turns text into terms at index time and query time, through character filters that clean the text, one tokenizer that splits it, and token filters that lowercase, remove or stem tokens. The standard analyzer turns 'The Quick-Brown Foxes!' into the, quick, brown and foxes, splitting on the hyphen and dropping punctuation without stemming, while the english analyzer removes 'the' and stems foxes to fox. The _analyze API shows the tokens for any analyzer or field.

What to say in the interviewAbout 80 seconds aloud

Open with

An analyzer is what turns text into the terms that go into the inverted index, and the same analyzer normally runs on the query text, so both sides produce comparable terms.

Then, if they want more

It has three stages in a fixed order. Character filters work on the raw string, for example stripping HTML or mapping characters. Then exactly one tokenizer splits the text into tokens with positions; the standard tokenizer uses Unicode word boundaries, so it splits on spaces, hyphens and punctuation.

Then token filters transform the token stream, like lowercase, stop word removal, stemming, synonyms or ASCII folding. For 'The Quick-Brown Foxes!' the standard analyzer, which is the default for text fields, gives four terms: the, quick, brown, foxes.

It splits on the hyphen, drops the exclamation mark and lowercases, but it does no stemming and its stop word list is empty by default, so 'the' stays and 'foxes' stays plural. The english analyzer would remove 'the' as a stop word and stem foxes to fox, so a search for fox would match.

Whenever I need to check this, I use the _analyze API, either with an analyzer name, a field from the mapping, or an ad hoc tokenizer and filter chain, and compare the tokens for the document text and the query text.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Elasticsearch documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "What does an analyzer do in Elasticsearch? Describe character filters, tokenizers and...": https://scrivio-interview-library.netlify.app/databases/search-engines/463ea76356/