I'm trying to use the Java API to help embed ElasticSearch in my
tests. I'm seem to be getting stuck with setting the "settings" on the
index. I have a JSON String:
I've tried the JSON in a number of formats based on examples that I've
seen. But nothing seems to have an effect on the created index. The
logs always come back with something like this:
... [Oddball] creating Index [myindex], shards [5]/[1]
(I'm expecting the number in brackets to be [1]/[0], is that
correct?) And the index is not in-memory.
Though, I can't tell now whether or not it's really a "memory-only"
index. For tests I would prefer it if the embedded cluster didn't
write to disk at all... Is there a way to make that happen?
I'm trying to use the Java API to help embed Elasticsearch in my
tests. I'm seem to be getting stuck with setting the "settings" on the
index. I have a JSON String:
I've tried the JSON in a number of formats based on examples that I've
seen. But nothing seems to have an effect on the created index. The
logs always come back with something like this:
... [Oddball] creating Index [myindex], shards [5]/[1]
(I'm expecting the number in brackets to be [1]/[0], is that
correct?) And the index is not in-memory.
Though, I can't tell now whether or not it's really a "memory-only"
index. For tests I would prefer it if the embedded cluster didn't
write to disk at all... Is there a way to make that happen?
I'm trying to use the Java API to help embed Elasticsearch in my
tests. I'm seem to be getting stuck with setting the "settings" on the
index. I have a JSON String:
I've tried the JSON in a number of formats based on examples that I've
seen. But nothing seems to have an effect on the created index. The
logs always come back with something like this:
... [Oddball] creating Index [myindex], shards [5]/[1]
(I'm expecting the number in brackets to be [1]/[0], is that
correct?) And the index is not in-memory.
I ending up doing something similar in my SBT by configuring the
Node's paths. The only other thing I can think of to do would be to
test for the existence of the "test/data" directory and blow it away
as tests startup.
A fun note, when you use SBT for testing, it will, by default, launch
tests in parallel. Each of my test cases start up a node on "setup"
and closes it on "tearDown" (BeforeClass, AfterClass in JUnit 4
terms). So these nodes would find each other and form a cluster.
Amazingly everything was working fine, but I decided to turn off
parallel execution just in case.
Though, I can't tell now whether or not it's really a "memory-only"
index. For tests I would prefer it if the embedded cluster didn't
write to disk at all... Is there a way to make that happen?
I'm trying to use the Java API to help embed Elasticsearch in my
tests. I'm seem to be getting stuck with setting the "settings" on the
index. I have a JSON String:
I've tried the JSON in a number of formats based on examples that I've
seen. But nothing seems to have an effect on the created index. The
logs always come back with something like this:
... [Oddball] creating Index [myindex], shards [5]/[1]
(I'm expecting the number in brackets to be [1]/[0], is that
correct?) And the index is not in-memory.
If you want to disable the "recovery" aspect (i.e.: stop a node, start it
again, and it will recover the indices created and so on), you can the
gateway.type setting to none. It will still write to "disk", but will not
use it.
You can use different cluster names to separate tests. Even something
like UUID can work (per test). Also, to make things run faster, you can use
"local" nodes, which don't do multicast discovery / use TCP for
communication (all done "local" to the VM).
I ending up doing something similar in my SBT by configuring the
Node's paths. The only other thing I can think of to do would be to
test for the existence of the "test/data" directory and blow it away
as tests startup.
A fun note, when you use SBT for testing, it will, by default, launch
tests in parallel. Each of my test cases start up a node on "setup"
and closes it on "tearDown" (BeforeClass, AfterClass in JUnit 4
terms). So these nodes would find each other and form a cluster.
Amazingly everything was working fine, but I decided to turn off
parallel execution just in case.
Though, I can't tell now whether or not it's really a "memory-only"
index. For tests I would prefer it if the embedded cluster didn't
write to disk at all... Is there a way to make that happen?
I'm trying to use the Java API to help embed Elasticsearch in my
tests. I'm seem to be getting stuck with setting the "settings" on the
index. I have a JSON String:
I've tried the JSON in a number of formats based on examples that I've
seen. But nothing seems to have an effect on the created index. The
logs always come back with something like this:
... [Oddball] creating Index [myindex], shards [5]/[1]
(I'm expecting the number in brackets to be [1]/[0], is that
correct?) And the index is not in-memory.
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.