6

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

javanna
  • 59,145
  • 14
  • 144
  • 125
Amir Movahedi
  • 1,802
  • 3
  • 29
  • 52

2 Answers2

8

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.

Community
  • 1
  • 1
Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Redis is Faster or ElasticSearch is? i cant connect redis to ElasticSearch ?http://java.dzone.com/articles/connecting-redis-elasticsearch – Amir Movahedi Sep 17 '13 at 13:31
  • Can both be used in a project ? – Amir Movahedi Sep 17 '13 at 13:44
  • Maybe I've asked the wrong question. So if I understand correctly, I need to or want to use Redis or ElasticSearch? What is the difference between Redis and ElasticSearch? And each of these can be applied to a social network what? – Amir Movahedi Sep 17 '13 at 14:30
  • @Amirhosseingholzam which is faster: a hammer, a screw-driver, or a saw? since they do different things: no comparison is possible. But yes, you can use both of them – Marc Gravell Sep 17 '13 at 15:27
  • 1
    @Amirhosseingholzam re the difference - redis is an in-memory key-value store with some interesting features, and lucene/elastic-search is an indexing service – Marc Gravell Sep 17 '13 at 15:28
  • thanks a lot for response.so, both can store data in memory , difference in indexing ? redis manual and the other is auto index? that's correct!? – Amir Movahedi Sep 17 '13 at 16:17
  • @amir Lucene has more tools for text indexing, yes – Marc Gravell Sep 17 '13 at 18:09
  • Sorry for being able to get your answer correctly.this means i can use Lucene in Redis ? stakexchange use redis for ... ? and use ElasticSearch for ...? – Amir Movahedi Sep 17 '13 at 18:53
  • @Amirhosseingholzam no, you cannot use lucene "in" redis. You can use two tools for two different jobs. We use redis for things that work well as key-based storage / key-based hashes, etc - and lucene for textual-content based searching – Marc Gravell Sep 17 '13 at 19:26
  • I concluded that the data should be searchable by text or read-only data can be classified. Group I store in ElasticSearch and Group II in Redis , is it true? – Amir Movahedi Sep 18 '13 at 18:08
  • @Amir I don't have enough information to offer a simple "yes" / "no" answer here; my aim is simply to point you at appropriate tools so that you can make your own technical decision / design – Marc Gravell Sep 18 '13 at 21:10
6

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.

Shōgun8
  • 482
  • 10
  • 20
  • _it will drop data._! Any reference for this? – Alireza Jul 10 '20 at 13:53
  • Yes there are references for the amount of data that elasticsearch can ingest, and it is a finite amount. The technical specifications can be found in the elasticsearch manual. – Shōgun8 Jul 10 '20 at 17:47
  • So by "it will drop" you meant inserting __new data__ will be throttled, right? – Alireza Jul 10 '20 at 18:21
  • 2
    No. Please read the technical manual. The data will be dropped never to be ingested again. Ever.Never ever. Never ever ever ever ever. – Shōgun8 Jul 10 '20 at 18:32