WARNING: The 2.x versions of Elasticsearch have passed their EOL dates. If you are running a 2.x version, we strongly advise you to upgrade.
This documentation is no longer maintained and may be removed. For the latest information, see the current Elasticsearch documentation.
Back in the early days of information retrieval, disk space and memory were limited to a tiny fraction of what we are accustomed to today. It was essential to make your index as small as possible. Every kilobyte saved meant a significant improvement in performance. Stemming (see Reducing Words to Their Root Form) was important, not just for making searches broader and increasing retrieval in the same way that we use it today, but also as a tool for compressing index size.
Another way to reduce index size is simply to index fewer words. For search purposes, some words are more important than others. A significant reduction in index size can be achieved by indexing only the more important terms.
So which terms can be left out? We can divide terms roughly into two groups:
- Low-frequency terms
- Words that appear in relatively few documents in the collection. Because of their rarity, they have a high value, or weight.
- High-frequency terms
Common words that appear in many documents in the index, such as
is. These words have a low weight and contribute little to the relevance score.
Of course, frequency is really a scale rather than just two points labeled low and high. We just draw a line at some arbitrary point and say that any terms below that line are low frequency and above the line are high frequency.
Which terms are low or high frequency depend on the documents themselves. The
and may be a low-frequency term if all the documents are in Chinese.
In a collection of documents about databases, the word
database may be a
high-frequency term with little value as a search term for that particular
That said, for any language there are words that occur very commonly and that seldom add value to a search. The default English stopwords used in Elasticsearch are as follows:
a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with
These stopwords can usually be filtered out before indexing with little negative impact on retrieval. But is it a good idea to do so?