Search code examples
elasticsearchindexinginverted-indexforward-indexing

What is the use of forward index in search, as we use inverted index in elastic search and get all the documents containing a particular word/words?


Elastic search use inverted index which is totally understandable because it returns all the documents containing the word we searched for. But I do not understand where do we use forward index? Like, we don't search for document and expect words containing in that particular document. Is there any practical use case for forward index? Any company using it for its product?


Solution

  • As mentioned in this SO answer, there is no technical difference between the forward index and the inverted index. Forward index is a list of terms contained within a particular document. The inverted index would be a list of documents containing a given term.

    Please go through this blog, where it is clearly mentioned that the forward index is pretty fast when indexing and have less efficient queries.

    Whereas inverted indexing have slower indexing, but fast query. To get a detailed explanation of the inverted index, you can refer to this article and this blog.