# ES as a database?

**URL:** <https://discuss.elastic.co/t/es-as-a-database/4827>\
**Category:** Elasticsearch\
**Created:** [July 9, 2011, 6:12pm UTC](https://discuss.elastic.co/t/es-as-a-database/4827 "2011-07-09T18:12:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajsie](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@ajsie](https://discuss.elastic.co/u/ajsie)\
**Post date:** [July 9, 2011, 6:12pm UTC](https://discuss.elastic.co/t/es-as-a-database/4827/1 "2011-07-09T18:12:59Z")

</div>

I have stumbled upon Elastic search which seems to be a very nice full  
text search engine. It is schema less, distributed, using JSON and  
RESTful API just like CouchDB.

You can add records and retrieve them, also do powerful search in the  
texts.

Here are my questions:

Could Elastic search be used as a database?  
Why would I want to put documents in CouchDB then put the same  
documents in Elastic search then only query from Elastic search?

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [July 9, 2011, 7:16pm UTC](https://discuss.elastic.co/t/es-as-a-database/4827/2 "2011-07-09T19:16:18Z")

</div>

On 9 Jul., 20:12, ajsie [johnny.weng....@gmail.com](mailto:johnny.weng....@gmail.com) wrote:

> I have stumbled upon Elastic search which seems to be a very nice full  
> text search engine. It is schema less, distributed, using JSON and  
> RESTful API just like CouchDB.
> 
> You can add records and retrieve them, also do powerful search in the  
> texts.
> 
> Here are my questions:
> 
> Could Elastic search be used as a database?

yes

> Why would I want to put documents in CouchDB then put the same  
> documents in Elastic search then only query from Elastic search?

There are normally limitations with search servers like e.g. Solr but  
many of them are avoided or can be neglected for Elasticsearch.

Examples:

1. indexing requires time and the document are searchable only after a  
'commit' in Solr =\> Elasticsearch supports near real time but still  
the document is searchable only after some latency time!

BUT Elasticsearch now (0.17) supports real time get requests which  
means you can put the doc into ES and check immediately if it is there  
or get the associated raw data. This is a big nice and cool feature 😉

1. normally setting up a replica or a shard requires a lot of planning  
and thinking (e.g. with Solr although ... it is ok to other commercial  
solutions :)) BUT with Elasticsearch this is really easy (especially  
to set up replicas)

2. ES has versioning support which makes it possible to avoid a  
refresh which reduces a lot load and e.g. Solr has no such versioning  
feature...

3. mutli tenancy is very very easy with ES (not so with Solr)

---

<div class="post-metadata">

**Author:** ![Chris\_Berkhout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_berkhout/32/3058_2.png) [@Chris\_Berkhout](https://discuss.elastic.co/u/Chris_Berkhout)\
**Post date:** [July 10, 2011, 4:11am UTC](https://discuss.elastic.co/t/es-as-a-database/4827/3 "2011-07-10T04:11:12Z")

</div>

If you're using Ruby take a look at Karel Minarik's "tire" gem.  
For info on using ES as your DB, look for "Tire implements not only  
searchable features, but also persistence features." near the end of  
the README at:

> **[GitHub - karmi/retire: A rich Ruby API and DSL for the Elasticsearch search...](https://github.com/karmi/retire)**
>
> A rich Ruby API and DSL for the Elasticsearch search engine - GitHub - karmi/retire: A rich Ruby API and DSL for the Elasticsearch search engine

If you are _only_ going to lookup your data from ES, that is a sign  
that you should seriously consider getting rid of CouchDB.

In my case, I'm using MongoDB via Mongoid as well, because Mongoid has  
more robust persistance for Rails than Tire currently does, and  
because MongoDB offers us ways to work with the data beyond store,  
search and retrieve (e.g. updating individual fields rather than the  
whole document, doing map-reduce, etc.)

Cheers,  
Chris

On Sun, Jul 10, 2011 at 3:16 AM, Karussell [tableyourtime@googlemail.com](mailto:tableyourtime@googlemail.com) wrote:

> On 9 Jul., 20:12, ajsie [johnny.weng....@gmail.com](mailto:johnny.weng....@gmail.com) wrote:
> 
> > I have stumbled upon Elastic search which seems to be a very nice full  
> > text search engine. It is schema less, distributed, using JSON and  
> > RESTful API just like CouchDB.
> > 
> > You can add records and retrieve them, also do powerful search in the  
> > texts.
> > 
> > Here are my questions:
> > 
> > Could Elastic search be used as a database?
> 
> yes
> 
> > Why would I want to put documents in CouchDB then put the same  
> > documents in Elastic search then only query from Elastic search?
> 
> There are normally limitations with search servers like e.g. Solr but  
> many of them are avoided or can be neglected for Elasticsearch.
> 
> Examples:
> 
> 1. indexing requires time and the document are searchable only after a  
> 'commit' in Solr =\> Elasticsearch supports near real time but still  
> the document is searchable only after some latency time!
> 
> BUT Elasticsearch now (0.17) supports real time get requests which  
> means you can put the doc into ES and check immediately if it is there  
> or get the associated raw data. This is a big nice and cool feature 😉
> 
> 1. normally setting up a replica or a shard requires a lot of planning  
> and thinking (e.g. with Solr although ... it is ok to other commercial  
> solutions :)) BUT with Elasticsearch this is really easy (especially  
> to set up replicas)
> 
> 2. ES has versioning support which makes it possible to avoid a  
> refresh which reduces a lot load and e.g. Solr has no such versioning  
> feature...
> 
> 3. mutli tenancy is very very easy with ES (not so with Solr)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:01am UTC](https://discuss.elastic.co/t/es-as-a-database/4827/4 "2017-07-06T04:01:06Z")

</div>


