diff --git a/chop/webapp/pom.xml b/chop/webapp/pom.xml
index d7703615f0..47be52e717 100644
--- a/chop/webapp/pom.xml
+++ b/chop/webapp/pom.xml
@@ -345,7 +345,12 @@
org.elasticsearch
elasticsearch
- 1.0.0
+ 5.4.0
+
+
+ org.elasticsearch.client
+ transport
+ 5.4.0
@@ -380,6 +385,11 @@
shiro-all
1.2.3
+
+ org.apache.lucene
+ lucene-core
+ 6.5.1
+
javax.mail
@@ -387,5 +397,10 @@
1.4.5
jar
+
+ io.netty
+ netty-transport
+ 4.1.11.Final
+
\ No newline at end of file
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
index a4ff74c97e..34d219f8a4 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/rest/RunManagerResource.java
@@ -40,8 +40,8 @@
import org.apache.usergrid.chop.webapp.dao.model.BasicRun;
import org.apache.usergrid.chop.webapp.dao.model.BasicRunResult;
import org.apache.usergrid.chop.webapp.elasticsearch.Util;
-
-import org.elasticsearch.indices.IndexMissingException;
+import org.elasticsearch.index.IndexNotFoundException;
+//import org.elasticsearch.indices.IndexMissingException;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -109,8 +109,7 @@ public Response next(
try {
next = runDao.getNextRunNumber( commitId );
- }
- catch ( IndexMissingException e ) {
+ } catch (IndexNotFoundException e) {
LOG.warn( "Got an index missing exception while looking up the next run number." );
return Response.ok( 0 ).build();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/CommitDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/CommitDao.java
index d81d6d5e20..bf0ed0a995 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/CommitDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/CommitDao.java
@@ -32,6 +32,8 @@
import org.apache.usergrid.chop.webapp.elasticsearch.Util;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.rest.RestResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
@@ -67,7 +69,7 @@ public boolean save( Commit commit ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( "modules", "commit", commit.getId() )
- .setRefresh( true )
+ // .setRefresh(true)
.setSource(
jsonBuilder()
.startObject()
@@ -78,8 +80,7 @@ public boolean save( Commit commit ) throws IOException {
)
.execute()
.actionGet();
-
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// isCreated();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ModuleDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ModuleDao.java
index 1e3e20480f..590b5e60ad 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ModuleDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ModuleDao.java
@@ -25,6 +25,7 @@
import org.apache.usergrid.chop.webapp.elasticsearch.Util;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -64,7 +65,7 @@ public boolean save( Module module ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, module.getId() )
- .setRefresh( true )
+ // .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -77,8 +78,7 @@ public boolean save( Module module ) throws IOException {
)
.execute()
.actionGet();
-
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// isCreated();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/NoteDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/NoteDao.java
index 72823c6808..ab8223b336 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/NoteDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/NoteDao.java
@@ -26,6 +26,7 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -50,7 +51,7 @@ public boolean save( Note note ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, note.getId() )
- .setRefresh( true )
+// .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -62,7 +63,7 @@ public boolean save( Note note ) throws IOException {
.execute()
.actionGet();
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// isCreated();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ProviderParamsDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ProviderParamsDao.java
index 50d89d4147..f53ba09823 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ProviderParamsDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/ProviderParamsDao.java
@@ -29,6 +29,7 @@
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -71,7 +72,7 @@ public boolean save( final ProviderParams pp ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, pp.getUsername() )
- .setRefresh( true )
+// .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -86,7 +87,7 @@ public boolean save( final ProviderParams pp ) throws IOException {
.execute()
.actionGet();
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// .isCreated();
}
/**
@@ -159,10 +160,10 @@ public List getAll() {
public boolean delete( String username ) {
DeleteResponse response = elasticSearchClient.getClient()
.prepareDelete( DAO_INDEX_KEY, DAO_TYPE_KEY, username )
- .setRefresh( true )
+// .setRefresh( true )
.execute()
.actionGet();
- return response.isFound();
+ return !response.getResult().equals(RestStatus.NOT_FOUND);//response.isFound();
}
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunDao.java
index eb647ebde4..3814670483 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunDao.java
@@ -42,10 +42,11 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
-import static org.elasticsearch.index.query.QueryBuilders.inQuery;
+//import static org.elasticsearch.index.query.QueryBuilders.inQuery;
import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery;
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
import static org.elasticsearch.index.query.QueryBuilders.termsQuery;
@@ -76,7 +77,7 @@ public boolean save( Run run ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, run.getId() )
- .setRefresh( true )
+ // .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -104,8 +105,7 @@ public boolean save( Run run ) throws IOException {
)
.execute()
.actionGet();
-
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// response.isCreated();
}
@@ -117,11 +117,10 @@ public boolean save( Run run ) throws IOException {
public boolean delete( Run run ) {
DeleteResponse response = elasticSearchClient.getClient()
.prepareDelete( DAO_INDEX_KEY, DAO_TYPE_KEY, run.getId() )
- .setRefresh( true )
+ // .setRefresh( true )
.execute()
.actionGet();
-
- return response.isFound();
+ return !response.getResult().equals(RestStatus.NOT_FOUND);// .isFound()
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunResultDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunResultDao.java
index e0c627df92..e3f1b9ea00 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunResultDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunResultDao.java
@@ -28,6 +28,7 @@
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -70,7 +71,7 @@ public boolean save( RunResult runResult ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, runResult.getId() )
- .setRefresh( true )
+// .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -86,7 +87,7 @@ public boolean save( RunResult runResult ) throws IOException {
.execute()
.actionGet();
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// .isCreated();
}
@@ -100,11 +101,11 @@ public boolean delete( String id ) {
DeleteResponse response = elasticSearchClient.getClient()
.prepareDelete( DAO_INDEX_KEY, DAO_TYPE_KEY, id )
- .setRefresh( true )
+// .setRefresh( true )
.execute()
.actionGet();
- return response.isFound();
+ return !response.getResult().equals(RestStatus.NOT_FOUND);//response.isFound();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunnerDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunnerDao.java
index 5534bb28d4..0169543564 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunnerDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/RunnerDao.java
@@ -27,6 +27,7 @@
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -65,7 +66,7 @@ public boolean save( Runner runner, String user, String commitId, String moduleI
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, runner.getUrl() )
- .setRefresh( true )
+ // .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -82,8 +83,7 @@ public boolean save( Runner runner, String user, String commitId, String moduleI
)
.execute()
.actionGet();
-
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// .isCreated();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/UserDao.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/UserDao.java
index 3a3f32c3af..1e3778e85f 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/UserDao.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/dao/UserDao.java
@@ -30,6 +30,7 @@
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.update.UpdateResponse;
+import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import java.io.IOException;
@@ -73,7 +74,7 @@ public boolean save( User user ) throws IOException {
IndexResponse response = elasticSearchClient.getClient()
.prepareIndex( DAO_INDEX_KEY, DAO_TYPE_KEY, user.getUsername() )
- .setRefresh( true )
+ // .setRefresh( true )
.setSource(
jsonBuilder()
.startObject()
@@ -83,7 +84,7 @@ public boolean save( User user ) throws IOException {
.execute()
.actionGet();
- return response.isCreated();
+ return response.getResult().equals(RestStatus.CREATED);// .isCreated();
}
/**
@@ -160,10 +161,9 @@ public boolean delete( String username ) {
DeleteResponse response = elasticSearchClient.getClient()
.prepareDelete( DAO_INDEX_KEY, DAO_TYPE_KEY, username )
- .setRefresh( true )
+ // .setRefresh( true )
.execute()
.actionGet();
-
- return response.isFound();
+ return !response.getResult().equals(RestStatus.NOT_FOUND);// response.isFound();
}
}
\ No newline at end of file
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/ElasticSearchClient.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/ElasticSearchClient.java
index 8fd46daff6..1f9ad60303 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/ElasticSearchClient.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/ElasticSearchClient.java
@@ -25,9 +25,9 @@
import com.google.inject.Singleton;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
-import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
+import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,6 +35,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -65,16 +66,16 @@ public Client start() {
host = elasticSearchFig.getTransportHost();
clusterName = elasticSearchFig.getClusterName();
- Settings settings = ImmutableSettings.settingsBuilder().put( "cluster.name", clusterName ).build();
- LOG.info( "Connecting Elasticsearch on {}", elasticSearchFig.getTransportHost() + ":" +
- elasticSearchFig.getTransportPort() );
+ Settings settings = Settings.builder().put("cluster.name", clusterName).build();
+ LOG.info("Connecting Elasticsearch on {}",
+ elasticSearchFig.getTransportHost() + ":" + elasticSearchFig.getTransportPort());
nodeList = getNodeList();
- TransportClient transportClient = new TransportClient( settings );
+ TransportClient transportClient = new PreBuiltTransportClient(settings);
for ( ElasticSearchNode elasticSearchNode : nodeList ) {
- LOG.debug( "Adding transport address with host {} and port {}", elasticSearchNode.getTransportHost()
- , elasticSearchNode.getTransportPort() );
- transportClient.addTransportAddress( new InetSocketTransportAddress( elasticSearchNode.getTransportHost(),
- elasticSearchNode.getTransportPort() ) );
+ LOG.debug("Adding transport address with host {} and port {}", elasticSearchNode.getTransportHost(),
+ elasticSearchNode.getTransportPort());
+ transportClient.addTransportAddress(new InetSocketTransportAddress(
+ new InetSocketAddress(elasticSearchNode.getTransportHost(), elasticSearchNode.getTransportPort())));
}
client = transportClient;
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EmbeddedUtils.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EmbeddedUtils.java
index eecceaedbb..f1241c0c6c 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EmbeddedUtils.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EmbeddedUtils.java
@@ -18,21 +18,20 @@
*/
package org.apache.usergrid.chop.webapp.elasticsearch;
+import static org.apache.usergrid.chop.webapp.elasticsearch.ElasticSearchFig.DATA_DIR_KEY;
-import org.elasticsearch.common.settings.ImmutableSettings;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+//import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
-import org.elasticsearch.node.NodeBuilder;
-import org.elasticsearch.node.internal.InternalNode;
-import org.elasticsearch.transport.netty.NettyTransport;
+import org.elasticsearch.node.Node;
+import org.elasticsearch.transport.netty4.Netty4Transport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import static org.apache.usergrid.chop.webapp.elasticsearch.ElasticSearchFig.DATA_DIR_KEY;
/**
@@ -42,7 +41,7 @@ public class EmbeddedUtils {
private static final Logger LOG = LoggerFactory.getLogger(EmbeddedUtils.class);
- public static void extractTransportInfo(InternalNode inode, ElasticSearchFig config) {
+ public static void extractTransportInfo(Node inode, ElasticSearchFig config) {
TransportAddress ta = getTransportAddress(inode);
LOG.info("ta = {}", ta.toString());
@@ -56,17 +55,16 @@ public static void extractTransportInfo(InternalNode inode, ElasticSearchFig con
}
- public static TransportAddress getTransportAddress(InternalNode inode) {
- return inode.injector().getInstance(NettyTransport.class).boundAddress().publishAddress();
+ public static TransportAddress getTransportAddress(Node inode) {
+ return inode.injector().getInstance(Netty4Transport.class).boundAddress().publishAddress();
}
- public static InternalNode newInstance(ElasticSearchFig config) {
- InternalNode inode = (InternalNode)
- NodeBuilder.nodeBuilder().settings(getSettings(config))
- .data(true)
- .clusterName(config.getClusterName())
- .node();
+ public static Node newInstance(ElasticSearchFig config) {
+ Node inode = new Node(getSettings(config));
+ // NodeBuilder.nodeBuilder().settings(
+ // ).data(true)
+ // .clusterName(config.getClusterName()).node();
extractTransportInfo(inode, config);
return inode;
@@ -103,7 +101,7 @@ public static Settings getSettings(ElasticSearchFig config) {
dataDir = config.getDataDir();
}
- return ImmutableSettings.settingsBuilder()
+ return Settings.builder()
.put("path.data", dataDir)
.build();
}
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EsEmbedded.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EsEmbedded.java
index 87c9472ff2..d29be79d5c 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EsEmbedded.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/elasticsearch/EsEmbedded.java
@@ -25,9 +25,11 @@
import com.google.inject.Singleton;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.node.internal.InternalNode;
+import org.elasticsearch.node.Node;
+//import org.elasticsearch.node.internal.InternalNode;
import org.safehaus.guicyfig.GuicyFigModule;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -38,7 +40,7 @@
@Singleton
public class EsEmbedded {
private final ElasticSearchFig config;
- private InternalNode inode;
+ private Node inode;
private boolean started;
@@ -65,7 +67,11 @@ public void start() {
public void stop() {
+ try {
inode.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
started = false;
}