Clearing out an index

I'm writing a Ruby application and doing some testing with RSpec. As part
of the RSpec setup process I'm creating indexes with the string "_test"
appended to the name.

After each test, I delete the indexes to ensure the data is clean for the
next test. However, I would like to avoid doing all of if possible.

Is there a command to simply clear and existing index?

Or would I just do a match_all query and use
this? http://www.elasticsearch.org/guide/reference/api/delete-by-query/

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

1 Like

I think dropping the index is the best option here. if you use delete by
query mappings will stay around that will not work for your tests.
What is your concern, performance?

simon

On Tuesday, August 6, 2013 9:14:50 PM UTC+2, Brandon Hilkert wrote:

I'm writing a Ruby application and doing some testing with RSpec. As part
of the RSpec setup process I'm creating indexes with the string "_test"
appended to the name.

After each test, I delete the indexes to ensure the data is clean for the
next test. However, I would like to avoid doing all of if possible.

Is there a command to simply clear and existing index?

Or would I just do a match_all query and use this?
Elasticsearch Platform — Find real-time answers at scale | Elastic

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Yeah, I have to add a non-trivial amount of sleep before each test to make
sure the test doesn't run before the index creation and fixture data gets
pushed.

On Tue, Aug 6, 2013 at 5:07 PM, simonw simon.willnauer@elasticsearch.comwrote:

I think dropping the index is the best option here. if you use delete by
query mappings will stay around that will not work for your tests.
What is your concern, performance?

simon

On Tuesday, August 6, 2013 9:14:50 PM UTC+2, Brandon Hilkert wrote:

I'm writing a Ruby application and doing some testing with RSpec. As part
of the RSpec setup process I'm creating indexes with the string "_test"
appended to the name.

After each test, I delete the indexes to ensure the data is clean for the
next test. However, I would like to avoid doing all of if possible.

Is there a command to simply clear and existing index?

Or would I just do a match_all query and use this? http://www.**
Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.elasticsearch.org/guide/reference/api/delete-by-query/

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jM8UvHrosxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You can use:

curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s'
See Elasticsearch Platform — Find real-time answers at scale | Elastic

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 août 2013 à 23:45, Brandon Hilkert brandon@pipelinedealsco.com a écrit :

Yeah, I have to add a non-trivial amount of sleep before each test to make sure the test doesn't run before the index creation and fixture data gets pushed.

On Tue, Aug 6, 2013 at 5:07 PM, simonw simon.willnauer@elasticsearch.com wrote:

I think dropping the index is the best option here. if you use delete by query mappings will stay around that will not work for your tests.
What is your concern, performance?

simon

On Tuesday, August 6, 2013 9:14:50 PM UTC+2, Brandon Hilkert wrote:

I'm writing a Ruby application and doing some testing with RSpec. As part of the RSpec setup process I'm creating indexes with the string "_test" appended to the name.

After each test, I delete the indexes to ensure the data is clean for the next test. However, I would like to avoid doing all of if possible.

Is there a command to simply clear and existing index?

Or would I just do a match_all query and use this? Elasticsearch Platform — Find real-time answers at scale | Elastic

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/jM8UvHrosxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Oh, this is awesome. Perfect.

On Tue, Aug 6, 2013 at 6:44 PM, David Pilato david@pilato.fr wrote:

You can use:

curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s'

See Elasticsearch Platform — Find real-time answers at scale | Elastic

HTH

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 6 août 2013 à 23:45, Brandon Hilkert brandon@pipelinedealsco.com a
écrit :

Yeah, I have to add a non-trivial amount of sleep before each test to make
sure the test doesn't run before the index creation and fixture data gets
pushed.

On Tue, Aug 6, 2013 at 5:07 PM, simonw simon.willnauer@elasticsearch.comwrote:

I think dropping the index is the best option here. if you use delete by
query mappings will stay around that will not work for your tests.
What is your concern, performance?

simon

On Tuesday, August 6, 2013 9:14:50 PM UTC+2, Brandon Hilkert wrote:

I'm writing a Ruby application and doing some testing with RSpec. As
part of the RSpec setup process I'm creating indexes with the string
"_test" appended to the name.

After each test, I delete the indexes to ensure the data is clean for
the next test. However, I would like to avoid doing all of if possible.

Is there a command to simply clear and existing index?

Or would I just do a match_all query and use this? http://www.**
Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.elasticsearch.org/guide/reference/api/delete-by-query/

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jM8UvHrosxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/jM8UvHrosxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.