Standalone runner expects path.home to be set
With elasticsearch 2.0, `path.home` must be set now. Standalone Runner (test) is using elasticsearch CLI which relies on `Environment` to be set. It produces now: ``` Exception in thread "main" java.lang.IllegalStateException: path.home is not configured at org.elasticsearch.env.Environment.<init>(Environment.java:99) at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:85) at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:107) at org.elasticsearch.common.cli.CliTool.<init>(CliTool.java:100) at org.elasticsearch.index.mapper.attachment.test.standalone.StandaloneRunner.<init>(StandaloneRunner.java:170) at org.elasticsearch.index.mapper.attachment.test.standalone.StandaloneRunner.main(StandaloneRunner.java:175) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) ``` Closes #167.
This commit is contained in:
parent
d110369968
commit
94459bd781
|
@ -66,6 +66,15 @@ public class StandaloneRunner extends CliTool {
|
|||
.cmds(TikaRunner.CMD)
|
||||
.build();
|
||||
|
||||
static {
|
||||
try {
|
||||
Path tmp = Files.createTempDirectory("tika");
|
||||
System.setProperty("es.path.home", tmp.getFileName().toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static class TikaRunner extends Command {
|
||||
private static final String NAME = "tika";
|
||||
private final String url;
|
||||
|
@ -113,7 +122,7 @@ public class StandaloneRunner extends CliTool {
|
|||
|
||||
terminal.println("## Extracted text");
|
||||
terminal.println("--------------------- BEGIN -----------------------");
|
||||
terminal.println("%s", doc.get(docMapper.mappers().getMapper("file").fieldType().names().indexName()));
|
||||
terminal.println("%s", doc.get("file.content"));
|
||||
terminal.println("---------------------- END ------------------------");
|
||||
terminal.println("## Metadata");
|
||||
printMetadataContent(doc, AttachmentMapper.FieldNames.AUTHOR);
|
||||
|
|
Loading…
Reference in New Issue