Does elasticsearch have a setting to clear all existing indexes on
startup?
This isn't for an April Fool's joke, but would be convenient for unit
tests (since there is no disk-less option), and also during
development.
Does elasticsearch have a setting to clear all existing indexes on
startup?
This isn't for an April Fool's joke, but would be convenient for unit
tests (since there is no disk-less option), and also during
development.
Eric,
You could delete/create the index (that's what I have done) or I imagine
you could use the delete by query API and use a match_all.
http://www.elasticsearch.org/guide/reference/api/delete-by-query.html
--Mike
On Sat, Mar 31, 2012 at 3:44 PM, Eric Jain eric.jain@gmail.com wrote:
Does elasticsearch have a setting to clear all existing indexes on
startup?This isn't for an April Fool's joke, but would be convenient for unit
tests (since there is no disk-less option), and also during
development.
If you use Java and Spring, you can use my Spring factory for that :
See forceReinit
David
Twitter : @dadoonet / @elasticsearchfr
Le 31 mars 2012 à 21:44, Eric Jain eric.jain@gmail.com a écrit :
Does elasticsearch have a setting to clear all existing indexes on
startup?This isn't for an April Fool's joke, but would be convenient for unit
tests (since there is no disk-less option), and also during
development.
This is not exactly an answer to your question, but there are settings that
prevent indices from being saved between cluster restarts:
gateway.type: none
index.store.type: memory
On Saturday, March 31, 2012 3:44:23 PM UTC-4, Eric Jain wrote:
Does elasticsearch have a setting to clear all existing indexes on
startup?This isn't for an April Fool's joke, but would be convenient for unit
tests (since there is no disk-less option), and also during
development.
On Sat, Mar 31, 2012 at 13:58, Igor Motov imotov@gmail.com wrote:
This is not exactly an answer to your question, but there are settings that
prevent indices from being saved between cluster restarts:gateway.type: none
index.store.type: memory
That's what I was looking for, thanks.
ElasticSearch allows you to create a local ES instance, that is in-memory, and the intention is to allow ES in unit tests.
Check this:
http://www.elasticsearch.org/guide/reference/java-api/client.html
import static org.elasticsearch.node.NodeBuilder.*;
// on startup
Node node = nodeBuilder().local(true).node();
Client client = node.client();
// on shutdown
node.close();
spokarna wrote:
Eric wrote:
Does elasticsearch have a setting to clear all existing indexes on
startup?This isn't for an April Fool's joke, but would be convenient for
unit tests (since there is no disk-less option), and also during
development.
ElasticSearch allows you to create a local ES instance, that is
in-memory, and the intention is to allow ES in unit tests.Check this:
http://www.elasticsearch.org/guide/reference/java-api/client.htmlimport static org.elasticsearch.node.NodeBuilder.*;
// on startup
Node node = nodeBuilder().local(true).node();
Client client = node.client();// on shutdown
node.close();
"local" is not related to index storage. It is a way to localize
discovery within a single JVM and prevent nodes from clustering over
TCP. It will still store index data on disk.
What Eric wants is to set index.store.type to either "ram" (lucene's
in-heap RAMDirectory) or "memory" (ByteBufferDirectory outside of
heap).
With either of these, index data will disappear with the cluster.
-Drew
--
Here are the properties I set for junit tests: https://github.com/dadoonet/spring-elasticsearch/blob/master/src/test/resources/es.properties
HTH
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 24 août 2012 à 15:40, Drew Raines aaraines@gmail.com a écrit :
spokarna wrote:
Eric wrote:
Does elasticsearch have a setting to clear all existing indexes on
startup?This isn't for an April Fool's joke, but would be convenient for
unit tests (since there is no disk-less option), and also during
development.
ElasticSearch allows you to create a local ES instance, that is
in-memory, and the intention is to allow ES in unit tests.Check this:
http://www.elasticsearch.org/guide/reference/java-api/client.htmlimport static org.elasticsearch.node.NodeBuilder.*;
// on startup
Node node = nodeBuilder().local(true).node();
Client client = node.client();// on shutdown
node.close();
"local" is not related to index storage. It is a way to localize
discovery within a single JVM and prevent nodes from clustering over
TCP. It will still store index data on disk.
What Eric wants is to set index.store.type to either "ram" (lucene's
in-heap RAMDirectory) or "memory" (ByteBufferDirectory outside of
heap).
With either of these, index data will disappear with the cluster.
-Drew
--
--
On Fri, Aug 24, 2012 at 6:54 AM, David Pilato david@pilato.fr wrote:
Here are the properties I set for junit tests: https://github.com/dadoonet/spring-elasticsearch/blob/master/src/test/resources/es.properties
Thanks; I already have these two properties set:
gateway.type=none
index.store.type=memory
This works, but elasticsearch still creates an empty directory
structure for the node and each index, which I need to clean up.
Adding the following two options from your es.properties doesn't seem
to make any difference:
index.gateway.type=none
index.store.fs.memory.enabled=true
--
In fact Path.data is set to maven target dir.
And here is a class that remove dir before each test:
https://github.com/dadoonet/fsriver/blob/master/src/test/java/org/elasticsearch/river/fs/AbstractFsRiverTest.java#L66
HTH
--
David
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 24 août 2012 à 18:27, Eric Jain eric.jain@gmail.com a écrit :
On Fri, Aug 24, 2012 at 6:54 AM, David Pilato david@pilato.fr wrote:
Here are the properties I set for junit tests: https://github.com/dadoonet/spring-elasticsearch/blob/master/src/test/resources/es.properties
Thanks; I already have these two properties set:
gateway.type=none
index.store.type=memory
This works, but elasticsearch still creates an empty directory
structure for the node and each index, which I need to clean up.
Adding the following two options from your es.properties doesn't seem
to make any difference:
index.gateway.type=none
index.store.fs.memory.enabled=true
--
--
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.