1

I'm currently designing the architecture of my project or atleast try to figure it out what will be useful in my case.

** Simple use case I will have several thousands of profiles in a backend and I to need implement a fast search engine. So elasticsearch look perfect in that case. Everytime a profile is updated, the index will be updated by an asynchronous task.

My question now is : If I want to implement a cache system for the detail of a profile. Should I stick with elasticsearch and put these data in my index ? Or use Redis and do something like profil_id => data ?

I think both sounds good the problem is whenever a profile is updated, I will have to flush it after the reindexing in elasticsearch. If I want to see the change in my backend.

So what can I do ? Thank you so much !

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
Elfyxoxo
  • 11
  • 2
  • how frequent the profiles are updated.what will be the user base – Sunder R Aug 17 '18 at 10:14
  • 1
    I can't exactly tell but I would say often cause there is many criterias, it depend but let's say atleast once a week to be sure. 500 000-1m users – Elfyxoxo Aug 17 '18 at 10:40
  • how often are profile details requested? is the profile detail data some aggregated data or just the document from ElasticSearch? – EisenRatte Aug 17 '18 at 13:56
  • thank you for all your answers. Profile are requested **everytime**, just the document for your second question – Elfyxoxo Aug 17 '18 at 14:16

2 Answers2

1

You should consider using RediSearch. Using RediSearch can provide you a solution for your needs, getting both Redis performance and a full-text support.

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
0

Elasticsearch and redis are basically meant to solve two different problems, As one does indexing while other does caching. Redis is meant to return already requested data as fast as possible whereas as Elasticsearch is a search and analytics engine, it would perfectly fit a use-case where you have to implement a fast search engine and it will be more performant than any in-memory data structure store or cache such as redis(Assuming your searches will be complex, will involve some aggregation/filters).

The problem comes profile updates Since your profile updates are not that frequent you could actually do partial updates to the ES index rather doing reindex.So whenever a person updates its profile get the changeling set(changed data) and do a partial update to the particular document in ES Index. You can see how its done here partial update.

This one particular stackoverflow answer will help you cache vs indexing

Sunder R
  • 1,074
  • 1
  • 7
  • 21