我在Neo4j
上复制了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
和nodes
这两种类型的171个节点的结果。但是,正如我的查询所说,我想仅通过其标题返回类型Movie
。所以基本上它看起来不是gas-filter
部分。
此外,当我将false
作为shouldExclude
的值时,我得到相同的结果。
[UPDATE]
我尝试了@Tezra的建议,我现在只返回了身份uuid
,我将shouldExclude
代替exclude
,但仍然得到相同的结果。
我正在使用:
应返回的结果:
标题为uuid
的电影的You've Got Mail
。
我尝试按照此tutorial进行配置,我发现index.gas.enable
的值为false
所以我更改了它并完成了配置,就像在教程中一样:< / p>
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
与gas-filter
执行相同的curl
查询,现在我收到此错误:
{
"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"
}
}
}
}
}
有什么想法吗?
答案 0 :(得分:0)
我发现我得到的Connection refused
例外是因为Wifi
。所以我不得不断开互联网的连接才能让它发挥作用。我知道这不是完美的解决方案。因此,如果有人找到了更好的方法,请在此处分享。