Hi all,
I've set up an in-memory ES which I use for testing purposes. But I can't
seem to get logging working (everything else works fine). I've set the
path.logs setting but do I need to do anything else? In particular do I
need my own logging.yml? - I only want simple logging to debug tests so was
hoping the defaults would be fine here...
My Scala code is below. Any thoughts appreciated.
object ElasticsearchLocalClient extends ElasticSearchClient {
lazy val client = node.client()
private[this] def node = {
val settings = ImmutableSettings.settingsBuilder()
.put("node.name", "my-local-node")
.put("node.data", true)
.put("cluster.name", "my-local-cluster")
.put("index.store.type", "memory")
.put("index.store.fs.memory.enabled", true)
.put("gateway.type", "none")
.put("path.data", "target/elasticsearch/data")
.put("path.logs", "target/elasticsearch/logs")
.put("index.number_of_shards", 1)
.put("index.number_of_replicas", 0)
.put("discovery.zen.ping.multicast.enabled", false)
.put("node.local", true)
Try(nodeBuilder().settings(settings).local(true).node()) match {
case Success(n) => n
case Failure(_: OverlappingFileLockException) => sys.error("Unable to
start Elasticsearch. Is it already running?")
case Failure(e) => sys.error(s"Unable to start Elasticsearch:
${e.getMessage}")
}
}
def start(index: String, mappings: Map[String, String]): Client = {
waitForGreen()
if (!indexExists(index)) {
createIndex(index, mappings) match {
case Success(_) => client
case Failure(e) => sys.error(s"Unable to add mappings to local
Elasticsearch: ${e.getMessage}")
}
} else client
}
def stop() {
client.close()
node.close()
FileSystemUtils.deleteRecursively(new File("./target/elasticsearch"),
true)
}
...
}
--
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.