Caching vs Indexing

后端 未结 3 617
花落未央
花落未央 2020-12-13 10:38

What\'s the real difference between a caching solution and an indexing solution? It seems to me that an indexing solution is in fact caching with the ability to run search q

3条回答
  •  隐瞒了意图╮
    2020-12-13 10:52

    Interesting question! Well you could in deed use elasticsearch to implement a cache. It provides some functions with witch you can expire documents, but I'm not sure whether they are well suited to expire the cache. The problem is that elasticsearch is not built to be a caching solution. It's sweet spot is indexing and finding documents.

    Indexing is the task of building an index, like it is done for the books: You read the entire text and write down on which page the words were found. This allows us later to find the positions of the words in the text very fast.

    Elasticsearch provides a toolbox that will allow you to define how to index and process the text, i.e. apply stemming. Then in the next step, it will provide you different types of queries to find your documents.

    You could, however, write documents into elasticsearch and use the id of the document to read it. Like that you could use elasticsearch as a store which might be used as a cache.

提交回复
热议问题