Skip to content

Commit 804dc2e

Browse files
committed
update to ES 1.1, 1.2
1 parent ac08ffe commit 804dc2e

File tree

4 files changed

+48
-49
lines changed

4 files changed

+48
-49
lines changed

README.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,20 @@ Installation
2121
============= ================= ================= ===========================================================
2222
ES version Plugin Release date Command
2323
------------- ----------------- ----------------- -----------------------------------------------------------
24-
0.19.8 0.19.8.1 Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1f1hk1c
25-
0.19.8 0.19.8.1 (+S3) Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1dxiqQJ
26-
0.19.11 0.19.11.3 Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1gmHPwY
27-
0.19.11 0.19.11.3 (+S3) Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1lTRgFF
28-
0.20.6 0.20.6.2 Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1gPILs5
29-
0.20.6 0.20.6.2 (+S3) Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1mlvRJh
30-
0.90.11 0.90.11.2 Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1mlzYoB
31-
0.90.11 0.90.11.2 (+S3) Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1j1yuuS
24+
1.2.0 1.2.0.0 May 23, 2014 ./bin/plugin -install knapsack -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-knapsack/1.2.0.0/elasticsearch-knapsack-1.2.0.0-plugin.zip
25+
1.2.0 1.2.0.0 (+S3) May 23, 2014 ./bin/plugin -install knapsack -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-knapsack/1.2.0.0/elasticsearch-knapsack-1.2.0.0-plugin-s3.zip
26+
1.1.0 1.1.0.0 May 25, 2014 ./bin/plugin -install knapsack -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-knapsack/1.1.0.0/elasticsearch-knapsack-1.1.0.0-plugin.zip
27+
1.1.0 1.1.0.0 (+S3) May 25, 2014 ./bin/plugin -install knapsack -url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-knapsack/1.1.0.0/elasticsearch-knapsack-1.1.0.0-plugin-s3.zip
3228
1.0.0 1.0.0.1 Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1bBRaBO
3329
1.0.0 1.0.0.1 (+S3) Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1cMFCX3
30+
0.90.11 0.90.11.2 Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1mlzYoB
31+
0.90.11 0.90.11.2 (+S3) Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1j1yuuS
32+
0.20.6 0.20.6.2 Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1gPILs5
33+
0.20.6 0.20.6.2 (+S3) Feb 16, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1mlvRJh
34+
0.19.11 0.19.11.3 Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1gmHPwY
35+
0.19.11 0.19.11.3 (+S3) Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1lTRgFF
36+
0.19.8 0.19.8.1 Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1f1hk1c
37+
0.19.8 0.19.8.1 (+S3) Feb 15, 2014 ./bin/plugin -install knapsack -url http://bit.ly/1dxiqQJ
3438
============= ================= ================= ===========================================================
3539

3640
The S3 version includes Amazon AWS API support, it can optionally transfer archives to S3.
@@ -42,11 +46,6 @@ Project docs
4246

4347
The Maven project site is available at `Github <http://jprante.github.io/elasticsearch-knapsack>`_
4448

45-
Binaries
46-
--------
47-
48-
Binaries (also older versions) are available at `Bintray <https://bintray.com/pkg/show/general/jprante/elasticsearch-plugins/elasticsearch-knapsack>`_
49-
5049
Overview
5150
========
5251

pom.xml

Lines changed: 17 additions & 9 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.1</version>
10+
<version>1.2.0.0</version>
1111

1212
<packaging>jar</packaging>
1313

@@ -36,29 +36,30 @@
3636

3737
<distributionManagement>
3838
<repository>
39-
<id>bintray-jprante-elasticsearch-plugins-elasticsearch-knapsack</id>
40-
<name>jprante-elasticsearch-plugins-elasticsearch-knapsack</name>
41-
<url>https://api.bintray.com/maven/jprante/elasticsearch-plugins/elasticsearch-knapsack</url>
39+
<id>xbib.org</id>
40+
<url>scpexe://xbib.org/repository</url>
4241
</repository>
4342
</distributionManagement>
4443

4544
<repositories>
4645
<repository>
47-
<id>bintray-elasticsearch-plugins</id>
48-
<url>http://dl.bintray.com/jprante/elasticsearch-plugins</url>
46+
<id>xbib</id>
47+
<url>http://xbib.org/repository</url>
4948
<releases>
5049
<enabled>true</enabled>
5150
</releases>
5251
<snapshots>
53-
<enabled>false</enabled>
52+
<enabled>true</enabled>
5453
</snapshots>
5554
</repository>
5655
</repositories>
5756

5857
<properties>
5958
<github.global.server>github</github.global.server>
6059
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
61-
<elasticsearch.version>1.0.0</elasticsearch.version>
60+
<elasticsearch.version>1.2.0</elasticsearch.version>
61+
<org.xbib.version>1.0.0.Beta3</org.xbib.version>
62+
<org.xbib.elasticsearch.support.version>1.2.0.0</org.xbib.elasticsearch.support.version>
6263
</properties>
6364

6465
<dependencies>
@@ -74,7 +75,7 @@
7475
<dependency>
7576
<groupId>org.xbib.elasticsearch.plugin</groupId>
7677
<artifactId>elasticsearch-support</artifactId>
77-
<version>1.0.0.2</version>
78+
<version>${org.xbib.elasticsearch.support.version}</version>
7879
<type>jar</type>
7980
<scope>compile</scope>
8081
</dependency>
@@ -105,6 +106,13 @@
105106
</dependencies>
106107

107108
<build>
109+
<extensions>
110+
<extension>
111+
<groupId>org.apache.maven.wagon</groupId>
112+
<artifactId>wagon-ssh-external</artifactId>
113+
<version>2.6</version>
114+
</extension>
115+
</extensions>
108116
<resources>
109117
<resource>
110118
<directory>${basedir}/src/main/resources</directory>

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

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
77
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
88
import org.elasticsearch.action.index.IndexRequest;
9-
import org.elasticsearch.action.search.SearchOperationThreading;
109
import org.elasticsearch.action.search.SearchRequest;
1110
import org.elasticsearch.action.search.SearchResponse;
1211
import org.elasticsearch.action.search.SearchType;
@@ -37,19 +36,19 @@
3736
import org.elasticsearch.rest.RestController;
3837
import org.elasticsearch.rest.RestHandler;
3938
import org.elasticsearch.rest.RestRequest;
40-
import org.elasticsearch.rest.XContentRestResponse;
41-
import org.elasticsearch.rest.XContentThrowableRestResponse;
4239
import org.elasticsearch.rest.action.search.RestSearchAction;
4340
import org.elasticsearch.search.SearchHit;
4441

4542
import org.xbib.elasticsearch.plugin.knapsack.KnapsackHelper;
4643
import org.xbib.elasticsearch.plugin.knapsack.KnapsackPacket;
4744
import org.xbib.elasticsearch.plugin.knapsack.KnapsackStatus;
48-
import org.xbib.io.ObjectPacket;
49-
import org.xbib.elasticsearch.support.client.bulk.BulkClient;
45+
import org.xbib.elasticsearch.rest.action.support.XContentRestResponse;
46+
import org.xbib.elasticsearch.rest.action.support.XContentThrowableRestResponse;
47+
import org.xbib.elasticsearch.support.client.bulk.BulkTransportClient;
5048
import org.xbib.io.Connection;
5149
import org.xbib.io.ConnectionFactory;
5250
import org.xbib.io.ConnectionService;
51+
import org.xbib.io.ObjectPacket;
5352
import org.xbib.io.Session;
5453

5554
import java.io.IOException;
@@ -68,7 +67,7 @@
6867
import static org.elasticsearch.rest.RestRequest.Method.POST;
6968
import static org.elasticsearch.rest.RestStatus.OK;
7069
import static org.elasticsearch.rest.RestStatus.BAD_REQUEST;
71-
import static org.elasticsearch.rest.action.support.RestXContentBuilder.restContentBuilder;
70+
import static org.xbib.elasticsearch.rest.action.support.RestXContentBuilder.restContentBuilder;
7271

7372
/**
7473
* The knapsack export action performs a scan/scroll action over a user defined query
@@ -170,7 +169,7 @@ private class ExportThread extends Thread {
170169

171170
private final RestRequest request;
172171

173-
private BulkClient bulkClient;
172+
private BulkTransportClient bulkClient;
174173

175174
private Connection<Session<KnapsackPacket>> connection;
176175

@@ -217,7 +216,7 @@ public void run() {
217216
try {
218217
logger.info("start of export: {}", status);
219218
knapsackHelper.addExport(status);
220-
this.bulkClient = new BulkClient();
219+
this.bulkClient = new BulkTransportClient();
221220
Map<String,Set<String>> indices = newHashMap();
222221
for (String s : Strings.commaDelimitedListToSet(request.param("index", "_all"))) {
223222
indices.put(s, Strings.commaDelimitedListToSet(request.param("type")));
@@ -300,14 +299,6 @@ public void run() {
300299
request.params().put("size", request.param("maxActionsPerBulkRequest", "1000"));
301300
searchRequest = RestSearchAction.parseSearchRequest(request);
302301
searchRequest.listenerThreaded(false);
303-
SearchOperationThreading operationThreading =
304-
SearchOperationThreading.fromString(request.param("operation_threading"), null);
305-
if (operationThreading != null) {
306-
if (operationThreading == SearchOperationThreading.NO_THREADS) {
307-
operationThreading = SearchOperationThreading.SINGLE_THREAD;
308-
}
309-
searchRequest.operationThreading(operationThreading);
310-
}
311302
for (String index : indices.keySet()) {
312303
searchRequest.searchType(SearchType.SCAN).scroll(timeout);
313304
if (!"_all".equals(index)) {
@@ -377,8 +368,10 @@ public void run() {
377368
session.close();
378369
}
379370
if (copy) {
380-
bulkClient.refresh().shutdown();
381-
bulkClient = null;
371+
for (String index : indices.keySet()) {
372+
bulkClient.refresh(index);
373+
}
374+
bulkClient.shutdown();
382375
}
383376
if (s3 && request.param("uri") != null) {
384377
// s3://auth:host, s3://host

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
import org.elasticsearch.rest.RestController;
2929
import org.elasticsearch.rest.RestHandler;
3030
import org.elasticsearch.rest.RestRequest;
31-
import org.elasticsearch.rest.XContentRestResponse;
32-
import org.elasticsearch.rest.XContentThrowableRestResponse;
3331

3432
import org.xbib.elasticsearch.plugin.knapsack.KnapsackException;
3533
import org.xbib.elasticsearch.plugin.knapsack.KnapsackHelper;
3634
import org.xbib.elasticsearch.plugin.knapsack.KnapsackPacket;
3735
import org.xbib.elasticsearch.plugin.knapsack.KnapsackStatus;
38-
import org.xbib.elasticsearch.support.client.bulk.BulkClient;
36+
import org.xbib.elasticsearch.rest.action.support.XContentRestResponse;
37+
import org.xbib.elasticsearch.rest.action.support.XContentThrowableRestResponse;
38+
import org.xbib.elasticsearch.support.client.bulk.BulkTransportClient;
3939
import org.xbib.io.Connection;
4040
import org.xbib.io.ConnectionFactory;
4141
import org.xbib.io.ConnectionService;
@@ -58,7 +58,7 @@
5858
import static org.elasticsearch.rest.RestRequest.Method.GET;
5959
import static org.elasticsearch.rest.RestRequest.Method.POST;
6060
import static org.elasticsearch.rest.RestStatus.OK;
61-
import static org.elasticsearch.rest.action.support.RestXContentBuilder.restContentBuilder;
61+
import static org.xbib.elasticsearch.rest.action.support.RestXContentBuilder.restContentBuilder;
6262

6363
/**
6464
* The knapsack import action opens an archive and transfers the content into Elasticsearch
@@ -166,7 +166,7 @@ private class ImportThread extends Thread {
166166

167167
private TimeValue timeout;
168168

169-
private BulkClient bulkClient;
169+
private BulkTransportClient bulkClient;
170170

171171
private Map<String,Object> map;
172172

@@ -205,7 +205,7 @@ public void run() {
205205
try {
206206
logger.info("start of import: {}", status);
207207
knapsackHelper.addImport(status);
208-
this.bulkClient = new BulkClient();
208+
this.bulkClient = new BulkTransportClient();
209209
Settings settings = KnapsackHelper.clientSettings(environment, destination);
210210
bulkClient.flushInterval(TimeValue.timeValueSeconds(5))
211211
.maxActionsPerBulkRequest(maxActionsPerBulkRequest)
@@ -308,12 +308,11 @@ else if ("_mapping".equals(id)) {
308308
session.close();
309309
for (String index : indexReplicaMap.keySet()) {
310310
try {
311-
bulkClient.setIndex(index);
312311
logger.info("setting refresh rate for index {}", index);
313-
bulkClient.update("index.refresh_interval", 1);
312+
bulkClient.stopBulk(index);
314313
Integer replica = Integer.parseInt(indexReplicaMap.get(index));
315314
logger.info("setting replica level {} for index {}", replica, index);
316-
bulkClient.update("index.number_of_replicas", replica);
315+
bulkClient.updateReplicaLevel(index, replica);
317316
} catch (Exception e) {
318317
logger.error(e.getMessage(), e);
319318
}

0 commit comments

Comments
 (0)