jprante / elasticsearch-knapsack

Knapsack plugin is an import/export tool for Elasticsearch
Apache License 2.0
472 stars 77 forks source link

Not able to use _import action in windows environment #38

Closed ghost closed 10 years ago

ghost commented 10 years ago

Try to do the following thing in Windows command line: D:>curl -XPOST "localhost:9200/_import" {"running":true,"mode":"import","type":"tar","path":"file:_all.tar.gz"}

Got errors in ES console, looks like issue caused by File.separator :

Unexpected internal error near index 1 \ ^ java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^ at java.util.regex.Pattern.error(Pattern.java:1924) at java.util.regex.Pattern.compile(Pattern.java:1671) at java.util.regex.Pattern.(Pattern.java:1337) at java.util.regex.Pattern.compile(Pattern.java:1022) at java.lang.String.split(String.java:2313) at java.lang.String.split(String.java:2355) at org.xbib.elasticsearch.plugin.knapsack.KnapsackPacket.decodeName(Knap sackPacket.java:59) at org.xbib.elasticsearch.action.RestImportAction$ImportThread.run(RestI mportAction.java:228) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:615) at java.lang.Thread.run(Thread.java:724)

jprante commented 10 years ago

Thanks.

jprante commented 10 years ago

The issue should be fixed in the latest versions. Please give it a try.

ghost commented 10 years ago

Hi @jprante, thanks for your fix. Right now it comes another issue, which might be related to this one.

When I am trying to import data (2 records) from one server to another, both in ES 1.0 and Windows version. I got following errors:

[2014-02-18 12:34:48,218][ERROR][org.xbib.elasticsearch.action.RestImportAction] [Geirrodur] archive entry too short, can't import org.xbib.elasticsearch.plugin.knapsack.KnapsackException: archive entry too shor t, can't import at org.xbib.elasticsearch.action.RestImportAction$ImportThread.run(RestI mportAction.java:233) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:615) at java.lang.Thread.run(Thread.java:724)

Looks like the problem comes from Line 231 of RestImportAction class:

String[] entry = KnapsackPacket.decodeName(packet.name());

We don't know what is packet name. Could you look into it as well? Thanks.

jprante commented 10 years ago

Thanks. Unfortunately I do not have Windows but I will look again into the backslash issue.