我在Elasticsearch上复制了Elasticsearch的电影数据库,它被索引为nodes。它有两种类型:Movie和Person。我试图使用这个curl命令行使用Result Filtering来制作一个简单的Graph-Aided Search:
curl -X GET localhost:9200/nodes/_search?pretty -d '{
"query": {
"match_all" : {}
},
"gas-filter": {
"name": "SearchResultCypherfilter",
"query": "MATCH (p:Person)-[ACTED_IN]->(m:Movie) WHERE p.name= 'Parker Posey' RETURN m.uuid as id",
"ShouldExclude": true,
"protocol": "bolt"
}
}'但结果是,索引Movie和Person中的171个节点都在索引nodes中。但是,正如我的查询所述,我只想按标题返回Movie类型。因此,基本上它不看gas-filter部分。
同样,当我将false作为shouldExclude的值时,我得到的结果也是一样的。
更新
我尝试了@Tezra的建议,我现在只返回id uuid,我将shouldExclude放在exclude而不是exclude,但仍然得到了相同的结果。
我的工作是:
应该返回的结果
电影的uuid名为You've Got Mail。
我试图为配置遵循这个教程,我发现index.gas.enable有值false,所以我更改了它并完成了配置,就像教程中的那样:
mac$ curl -XPUT http://localhost:9200/nodes/_settings?index.gas.neo4j.hostname=http://localhost:7474
{"acknowledged":true}
mac$ curl -XPUT http://localhost:9200/nodes/_settings?index.gas.enable=true
{"acknowledged":true}
mac$ curl -XPUT http://localhost:9200/indexname/_settings?index.gas.neo4j.user=neo4j
{"acknowledged":true}
mac$ curl -XPUT http://localhost:9200/indexname/_settings?index.gas.neo4j.password=mypassword
{"acknowledged":true}之后,我尝试添加boltHostname和bolt.secure的设置,但是没有工作,因此出现了以下错误:
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Can't update non dynamic settings[[index.gas.neo4j.boltHostname]] for open indices [[nodes]]"}],"type":"illegal_argument_exception","reason":"Can't update non dynamic settings[[index.gas.neo4j.boltHostname]] for open indices [[nodes]]"},"status":400}所以我关闭了我的索引来配置它,然后再次打开它:
mac$ curl -XPOST http://localhost:9200/nodes/_close
{"acknowledged":true}
mac$ curl -XPUT http://localhost:9200/nodes/_settings?index.gas.neo4j.boltHostname=bolt://localhost:7687
{"acknowledged":true}
mac$ curl -XPUT http://localhost:9200/nodes/_settings?index.gas.neo4j.bolt.secure=false
{"acknowledged":true}
mac$ curl -XPOST http://localhost:9200/nodes/_open
{"acknowledged":true}在完成配置之后,我在Postman上再次尝试使用curl执行的相同的gas-filter查询,现在我得到了这个错误:
{
"error": {
"root_cause": [
{
"type": "runtime_exception",
"reason": "Failed to parse a search response."
}
],
"type": "runtime_exception",
"reason": "Failed to parse a search response.",
"caused_by": {
"type": "client_handler_exception",
"reason": "java.net.ConnectException: Connection refused (Connection refused)",
"caused_by": {
"type": "connect_exception",
"reason": "Connection refused (Connection refused)"
}
}
},
"status": 500
}我不知道这个错误说的是哪种联系。我确信我在配置中传递了正确的Neo4j密码。我甚至停止并重新启动了Elasticsearch和Neo4j的服务器,但是仍然是相同的错误。
我的索引nodes的设置如下:
{
"nodes" : {
"settings" : {
"index" : {
"gas" : {
"enable" : "true",
"neo4j" : {
"hostname" : "http://localhost:7474",
"password" : "neo4j.",
"bolt" : {
"secure" : "false"
},
"boltHostname" : "bolt://localhost:7687",
"user" : "neo4j"
}
},
"creation_date" : "1495531307760",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "SdrmQKhXQmyGKHmOh_xhhA",
"version" : {
"created" : "2030299"
}
}
}
}
}有什么想法吗?
发布于 2017-06-14 12:36:51
我发现,我得到的Connection refused异常是因为Wifi。所以我不得不与互联网断绝联系,才能让它正常工作。我知道这不是完美的解决办法。所以如果有人找到了更好的方法,请在这里分享。
https://stackoverflow.com/questions/44415990
复制相似问题