Hello stackoverflowers!
I'm trying to use the library elastic4s with scala, but when I run the following code (in order to fetch the list of ads within the index ads):
trait elastic4s {
def get: Future[SearchResponse] = {
val client = ElasticClient.local
client execute { search in "ads"->"ad" }
}
}
I got this exception :
An error has occured: org.elasticsearch.indices.IndexMissingException: [ads] missing
Pastebin with full output here.
Here is my configuration:
-- 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 is up and running, on localhost:9200, and this index ads exists. This CURL request:
curl -XGET 'http://localhost:9200/ads/ad/_search'
returns
{
"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"
}
}
]
}
}
I can't understand... If anyone could give me a track :)
A local node won't communicate with other Elasticsearch instances running outside that process. A local node is local to the JVM.
The code comments say:
"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."
You need to use a remote client to connect to external instances, even if they're running locally. I guess that seems counter-intuitive but remote really means IPC or Socket based.