我的目标是在junit测试中启动localhost elasticsearch节点,这样我就可以索引一些文档,并通过高级别的rest客户端测试搜索查询(例如,对localhost ES节点进行http调用)。我使用的是Elasticsearch 6.2。
这是我试过的代码
String clusterName = "test";
Settings settings = Settings.builder()
.put("path.home", ES_WORKING_DIR)
.build();
new Node(settings).start();
这是我收到的错误信息..
java.lang.IllegalStateException: Unsupported transport.type []
at __randomizedtesting.SeedInfo.seed([74752622FDACDD5:AB9FD863FD5A2A5F]:0)
at org.elasticsearch.common.network.NetworkModule.getTransportSupplier(NetworkModule.java:212)
at org.elasticsearch.node.Node.<init>(Node.java:427)
at org.elasticsearch.node.Node.<init>(Node.java:246)
at org.elasticsearch.node.Node.<init>(Node.java:242)
基本上,我不确定在“设置”中设置哪些参数。
提前致谢。
答案 0 :(得分:0)
我有
#rm(list=ls())
gc()
#setwd('/******/Desktop/Applied/isds 574/R')
dat = read.csv('cleaned.csv', stringsAsFactors=T, head=T)
#dropping Longtitude and Latitude
dat$longitude = NULL
dat$latitude = NULL
dat$X = NULL
#Factors
dat$ocean_proxy_dummy = as.factor(dat$ocean_proxy_dummy)
# divide the data into 2 sets: training and validation
set.seed(1)
id.train = sample(1:nrow(dat), nrow(dat)*.6)
id.test = setdiff(1:nrow(dat), id.train)
#KNN2
library(FNN)
Knn.reg.bestK = function(xtrain, xtest, ytrain, ytest, Kmax = 10) {
vec.rmse = rep(NA, Kmax)
for (K in 1:Kmax) {
yhat.test = Knn.reg(xtrain, xtest, ytrain, k)$pred
vec.rmse[K] = rmse(yhat.test, ytest)
}
list(K.opt = which.min(vec.rmse), rmse.min = min(vec.rmse), vec.rmse)
}