Skip to content

Commit be52947

Browse files
committed
compatibility for import
1 parent 17581ce commit be52947

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>org.xbib.elasticsearch.plugin</groupId>
99
<artifactId>elasticsearch-knapsack</artifactId>
10-
<version>1.0.0.RC1.1</version>
10+
<version>1.0.0.RC1.2</version>
1111

1212
<packaging>jar</packaging>
1313

@@ -97,7 +97,7 @@
9797
<dependency>
9898
<groupId>org.hamcrest</groupId>
9999
<artifactId>hamcrest-all</artifactId>
100-
<version>1.3</version>
100+
<version>1.1</version>
101101
<scope>test</scope>
102102
</dependency>
103103

src/main/java/org/xbib/elasticsearch/action/RestImportAction.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,14 @@ public void run() {
201201
String lastCoord = null;
202202
while ((packet = session.read()) != null) {
203203
String[] entry = KnapsackPacket.decodeName(packet.name());
204-
if (entry.length != 4) {
204+
if (entry.length < 2) {
205205
throw new ElasticsearchIllegalStateException("archive entry too short, can't import");
206206
}
207207
String index = entry[0];
208208
String type = entry[1];
209-
String id = entry[2];
210-
String field = entry[3];
209+
// entry length != 4 ? older knapsack format
210+
String id = entry.length > 2 ? entry[2] : null;
211+
String field = entry.length > 3 ? entry[3] : "_source";
211212
if ("_settings".equals(type)) {
212213
index = mapIndex(index);
213214
String settings;

0 commit comments

Comments
 (0)