Using elasticsearch as my primary database


(Amy) #1

Hi,
I'm considering using elasticsearch as my primary db, the alternative being
a couchbase-elasticsearch combo.
Group discussionshttps://groups.google.com/forum/?fromgroups=#!searchin/elasticsearch/primary$20database/elasticsearch/qAnXu5w3pn4/Te1vli7dfccJappear positive, but I have an issue that I have not seen discussed. If I
want to change an index mapping, I need to flush the index. This deletes
everything I have stored on Elasticsearch.
Is there an alternative?

--


(Radu Gheorghe) #2

Hello Amy,

If you add new fields to your mapping, it should work just fine
(they're added to your current mapping). If you try to change the type
of a certain field in your mapping, you will get an error, but
flushing[0] the index doesn't delete your data.

If you need to change the type of a field (let's say from long to
float), you have to reindex your data. You can do that on the live
cluster by scrolling[1] through your data and indexing it in a
different type where you have the new mapping.

Of course if your indices become corrupt for any reason (eg: file
system failure), there's no getting away from backups. But that should
be the same for any database.

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

[0] http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html
[1] http://www.elasticsearch.org/guide/reference/api/search/scroll.html

On Wed, Oct 17, 2012 at 6:19 PM, Amy amyblarney@gmail.com wrote:

Hi,
I'm considering using elasticsearch as my primary db, the alternative being
a couchbase-elasticsearch combo.
Group discussions appear positive, but I have an issue that I have not seen
discussed. If I want to change an index mapping, I need to flush the index.
This deletes everything I have stored on Elasticsearch.
Is there an alternative?

--

--


(Amy) #3

Thank you Radu, that helped. I also found this example of how to reindex in
Perl: http://blogs.perl.org/users/clinton_gormley/2011/04/elasticsearchpm-v036-now-with-extra-sugar.html

On Wednesday, October 17, 2012 5:06:54 PM UTC+1, Radu Gheorghe wrote:

Hello Amy,

If you add new fields to your mapping, it should work just fine
(they're added to your current mapping). If you try to change the type
of a certain field in your mapping, you will get an error, but
flushing[0] the index doesn't delete your data.

If you need to change the type of a field (let's say from long to
float), you have to reindex your data. You can do that on the live
cluster by scrolling[1] through your data and indexing it in a
different type where you have the new mapping.

Of course if your indices become corrupt for any reason (eg: file
system failure), there's no getting away from backups. But that should
be the same for any database.

Best regards,
Radu

http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

[0]
http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html
[1] http://www.elasticsearch.org/guide/reference/api/search/scroll.html

On Wed, Oct 17, 2012 at 6:19 PM, Amy <amybl...@gmail.com <javascript:>>
wrote:

Hi,
I'm considering using elasticsearch as my primary db, the alternative
being
a couchbase-elasticsearch combo.
Group discussions appear positive, but I have an issue that I have not
seen
discussed. If I want to change an index mapping, I need to flush the
index.
This deletes everything I have stored on Elasticsearch.
Is there an alternative?

--

--


(system) #4