gpt4 book ai didi

elasticsearch - 图辅助搜索结果过滤示例

转载 作者:行者123 更新时间:2023-12-03 00:06:43 25 4
gpt4 key购买 nike

我已经在Neo4j上复制了Elasticsearch的Movie数据库,并且使用索引nodes对其进行了索引。它有两种类型MoviePerson。我正在尝试使用此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中的所有171t类型为 Personnodes的节点。但是,正如我的查询所说,我只想按其标题返回 Movie类型。因此,基本上,它不希望看到 gas-filter部分。

另外,当我将 false用作 shouldExclude的值时,我得到的结果也相同。

[更新]

我尝试了@Tezra的建议,我现在只返回id uuid,我放了 shouldExclude而不是 exclude,但仍然得到相同的结果。

我正在与:
  • Elasticsearch 2.3.2
  • graph-aided-search-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

  • 应该返回的结果:

    电影的 uuid名为 You've Got Mail

    我尝试按照此 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}

    之后,我尝试添加 boltHostnamebolt.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密码。我什至停止并重新启动了 ElasticsearchNeo4j服务器,但仍然存在相同的错误。

    我的索引 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"
    }
    }
    }
    }
    }

    有任何想法吗?

    最佳答案

    我发现我得到的Connection refused异常是由于Wifi引起的。因此,我必须断开与互联网的连接才能使其正常运行。我知道这不是完美的解决方案。因此,如果有人发现更好的方法,请在此处分享。

    关于elasticsearch - 图辅助搜索结果过滤示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44415990/

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