InterviewSolution
| 1. |
What is an Inverted index in ElasticSearch? |
||||||||||||||||||||||||||||||||||||||||||||||||
|
Answer» ElasticSearch utilizes a hashmap-like data structure known as an inverted index that allows for rapid full-text searches. The inverted index lists all the unique words that appear in one or more documents and identifies all the documents those words appear in. With it, you can conduct QUICK searches across millions of documents to find relevant data. Example: Let's assume we have TWO different documents:
The above texts have been tokenized first into separate terms for indexing purposes. All the unique terms are then stored in the index, along with information such as which DOCUMENT the term appears in, its position, as WELL as how many times it appeared. ACCORDINGLY, the inverted index is as follows:
Let's say you are looking for a term company or companies. With this inverted index, queries can search for terms and quickly identify documents that contain these terms. |
|||||||||||||||||||||||||||||||||||||||||||||||||