【发布时间】:2017-06-07 14:49:17
【问题描述】:
我在Elasticsearch 上复制了Neo4j 的电影数据库,并使用索引nodes 对其进行了索引。它有Movie 和Person 两种类型。我正在尝试使用此 curl 命令行使用 Graph-Aided Search 制作一个简单的 Result Filtering:
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"
}
}'
但是我在索引nodes 中得到了Movie 和Person 两种类型的所有171 个节点。但是,正如我的查询所说,我只想按标题返回类型 Movie。所以基本上它不看gas-filter 部分。
此外,当我将 false 作为 shouldExclude 的值时,我得到了相同的结果。
[更新]
我尝试了@Tezra 的建议,我现在只返回 id uuid 并输入 shouldExclude 而不是 exclude,但仍然得到相同的结果。
我正在与:
- 弹性搜索 2.3.2
- 图形辅助搜索-2.3.2.0
- Neo4j 社区 2.3.2.10
- graphaware-uuid-2.3.2.37.7
- graphaware-server-community-all-2.3.2.37
- graphaware-neo4j-to-elasticsearch-2.3.2.37.1
应该返回的结果:
电影You've Got Mail的uuid。
我尝试按照tutorial 进行配置,我发现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"
}
}
}
}
}
有什么想法吗?
【问题讨论】:
-
不应该是“shouldExclude”而不是“exclude”吗?另外,我认为您只需要返回 m.id。
-
@Tezra 即使使用
shouldExclude而不是exclude我也得到了相同的结果。为什么我应该只返回 m.id?
标签: elasticsearch neo4j cypher graphaware