Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Redis with ElasticSearch

I found NEST for ElasticSearch. But I did not realize how the relation between Redis and ElasticSearch. I'll build a social network and would like to know whether you have some parts Redis and some parts of ElasticSearch should be used or a combination of them.what part of the project i use Redis and which parts ElasticSearch use and which parts should be combined use.

I use C# , BookSleeve for Redis , ElasticSearch with NEST , ASP.NET MVC

like image 944
Amir Movahedi Avatar asked Dec 08 '22 12:12

Amir Movahedi


2 Answers

There is exactly zero relationship between these two things. I suspect you may have gotten the wrong end of the stick in a previous conversation, where you were wanting to search inside an individual value in redis for uses of a work (this question: How to search content value in redis by BookSleeve). The point I was trying to make is that this simply isn't a feature of redis. So you have two options:

  • write your own word extraction code (stemmer, etc) and build an index manually inside redis
  • use a tool that is designed to do all of that for you

Tools like ElasticSearch (which sits on top of lucene) are good at that.

Or to put the question in other terms:

  • X asks "how do I cut wood in half with a screwdriver"
  • Y says "use a saw"
  • X then asks "how do I use a screwdriver with a saw to cut wood in half?"

Answer: you don't. These things are not related.

like image 112
Marc Gravell Avatar answered Dec 21 '22 22:12

Marc Gravell


Actually Redis and Elasticsearch can be combined in quite a useful way; if you are pushing data into Elasticsearch from a source stream, and that stream of data suddenly bursts and becomes too much data for your Elasticsearch instance to ingest, then it will drop data. If however, you put a Redis instance in front of Elasticsearch to cache the data, then your Elasticsearch instance can survive the bursting without losing data because it will be cached in Redis.

That's just one example, but there are many more. see here for an example of how to cache queries.

like image 20
Shōgun8 Avatar answered Dec 22 '22 00:12

Shōgun8