gpt4 book ai didi

scala - 具有Scala和elastic4s的IndexMissingException

转载 作者:行者123 更新时间:2023-12-02 23:40:17 25 4
gpt4 key购买 nike

您好stackoverflowers!

我尝试将库Elastic4s与Scala结合使用,但是当我运行以下代码时(以获取索引广告中的广告列表):

trait elastic4s {
def get: Future[SearchResponse] = {
val client = ElasticClient.local
client execute { search in "ads"->"ad" }
}
}

我有这个异常(exception):
An error has occured: org.elasticsearch.indices.IndexMissingException: [ads] missing

Pastebin与 full output here.

这是我的配置:
-- Java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

-- ElasticSearch
version 1.0.1

-- Elastic4s
version 2.10-1.0.1

Elastic Search已在localhost:9200上启动并运行,并且该索引广告存在。此CURL请求:
curl -XGET 'http://localhost:9200/ads/ad/_search'

退货
{
"took": 6,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "ads",
"_type": "ad",
"_id": "UrKm89AXTzOxB9kFdpue4Q",
"_score": 1,
"_source": {
"json": "json"
}
}
]
}
}

我不明白...如果有人可以给我一个音轨:)

最佳答案

本地节点不会与在该进程外运行的其他Elasticsearch实例通信。本地节点是JVM本地的。

代码注释说:

"Is the node a local node. A local node is a node that uses a local (JVM level) discovery transport. Other (local) nodes started within the same JVM (actually, class-loader) will be discovered and communicated with. Nodes outside of the JVM will not be discovered."



您需要使用远程客户端连接到外部实例,即使它们在本地运行。我想这似乎违反直觉,但远程确实意味着基于IPC或Socket。

关于scala - 具有Scala和elastic4s的IndexMissingException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22684625/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com