You may already have noticed that the word index is overloaded with several meanings in the context of Elasticsearch. A little clarification is necessary:
- Index (noun)
-
As explained previously, an index is like a database in a traditional relational database. It is the place to store related documents. The plural of index is indices or indexes.
- Index (verb)
-
To index a document is to store a document in an index (noun) so that it can be retrieved and queried. It is much like the
INSERT
keyword in SQL except that, if the document already exists, the new document would replace the old. - Inverted index
-
Relational databases add an index, such as a B-tree index, to specific columns in order to improve the speed of data retrieval. Elasticsearch and Lucene use a structure called an inverted index for exactly the same purpose.
By default, every field in a document is indexed (has an inverted index) and thus is searchable. A field without an inverted index is not searchable. We discuss inverted indexes in more detail in [inverted-index].