我正在尝试使用Java API连接到ElasticSearch服务器.我使用elasticsearch服务来启动/停止和弹性搜索头来可视化集群.群集/节点处于活动状态,REST API在9200上通过卷曲工作正常.我已经阅读了关于此主题的几乎所有帖子,但我无法使其工作,下面是我的详细信息:
我尝试了所有这些:
... 9200/_cluster /节点
{
"ok": true,
"cluster_name": "test",
"nodes": {
"NLVBbJpJTZWefeI2kQt3Tg": {
"name": "inventory_management",
"transport_address": "inet[/127.0.0.1:9300]",
"hostname": "devhost1",
"version": "0.90.5",
"http_address": "inet[/127.0.0.1:9200]"
}
}
}
Run Code Online (Sandbox Code Playgroud)
... 9200/_cluster /健康?漂亮=真
{
"cluster_name" : "test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0
}
Run Code Online (Sandbox Code Playgroud)
Java代码:
Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "test").put("node.name", "inventory_management").build();
Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("localhost", …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Ebean在Play中创建以下类:
public class BaseModel extends Model {
@Column(name = "created_at")
public Date createdAt;
@Column(name = "updated_at")
public Date updatedAt;
@PrePersist
public void createdAt() {
this.createdAt = this.updatedAt = new Date();
}
@PreUpdate
public void updatedAt() {
this.updatedAt = new Date();
}
}
Run Code Online (Sandbox Code Playgroud)
它编译没问题,但是当我用我的实体bean子类化这个类时(所以每个都会插入时间戳进行创建和更新)我在尝试点击应用程序时遇到以下异常:
play.api.UnexpectedException: Unexpected exception[PersistenceException: Error with [models.InventoryItem] I believe it is not enhanced but it's superClass [class models.BaseModel] is? (You are not allowed to mix enhancement in a single inheritance hierarchy)]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:150) ~[play_2.10.jar:2.1.4]
at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:114) ~[play_2.10.jar:2.1.4]
at …Run Code Online (Sandbox Code Playgroud)