且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法从neo4j创建弹性搜索索引

更新时间:2023-02-08 19:14:43

您是否使用AWS ElasticSearch?它们不允许连接到各个节点。我在别处阅读(来自AWS团队):
查看日志,似乎iscconfig.discovery.NodeChecker正在尝试自动发现并连接到集群的各个节点。很难改进服务功能,但不幸的是,在这个时候,AWS不允许客户端连接到集群的各个节点,而是可以使用URL



ClientConfig clientConfig = new ClientConfig.Builder(http:// localhost:9200).discoveryEnabled(false) code>

请参阅 https://github.com/searchbox-io/Jest/blob/master/jest/README.md#node-discovery-through-nodes-api


I want to create elastic search indexes on neo4j data. I reffered https://github.com/neo4j-contrib/neo4j-elasticsearch and https://www.***.com/watch?v=SJLSFsXgOvA&ab_channel=AnmolAgrawal to create elasticsearch index from neo4j.

But after that, im getting below error in neo4j.log file.

    2016-11-08 12:20:09.825+0000 WARN  Error updating ElasticSearch  No Server is assigned to client to connect
io.searchbox.client.config.exception.NoServerConfiguredException: No Server is assigned to client to connect
    at io.searchbox.client.AbstractJestClient$ServerPool.getNextServer(AbstractJestClient.java:132)
    at io.searchbox.client.AbstractJestClient.getNextServer(AbstractJestClient.java:81)
    at io.searchbox.client.http.JestHttpClient.prepareRequest(JestHttpClient.java:80)
    at io.searchbox.client.http.JestHttpClient.executeAsync(JestHttpClient.java:60)
    at org.neo4j.elasticsearch.ElasticSearchEventHandler.afterCommit(ElasticSearchEventHandler.java:81)
    at org.neo4j.elasticsearch.ElasticSearchEventHandler.afterCommit(ElasticSearchEventHandler.java:27)
    at org.neo4j.kernel.internal.TransactionEventHandlers.afterCommit(TransactionEventHandlers.java:149)
    at org.neo4j.kernel.internal.TransactionEventHandlers.afterCommit(TransactionEventHandlers.java:47)
    at org.neo4j.kernel.impl.api.TransactionHooks.afterCommit(TransactionHooks.java:75)
    at org.neo4j.kernel.impl.api.KernelTransactionImplementation.afterCommit(KernelTransactionImplementation.java:541)
    at org.neo4j.kernel.impl.api.KernelTransactionImplementation.commit(KernelTransactionImplementation.java:482)
    at org.neo4j.kernel.impl.api.KernelTransactionImplementation.close(KernelTransactionImplementation.java:380)
    at org.neo4j.server.rest.transactional.TransitionalTxManagementKernelTransaction.commit(TransitionalTxManagementKernelTransaction.java:92)
    at org.neo4j.server.rest.transactional.TransactionHandle.closeContextAndCollectErrors(TransactionHandle.java:243)
    at org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:151)
    at org.neo4j.server.rest.web.TransactionalService.lambda$executeStatementsAndCommit$29(TransactionalService.java:202)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
    at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

How to fix this error or is there any other way to update index if neo4j node's property value changes?

Are you using AWS ElasticSearch? They do not allow connecting to individual nodes. I read elsewhere (from the AWS team): "Looking over the logs, it seems that 'i.s.c.config.discovery.NodeChecker' is trying to auto discover and connect to the individual nodes of the cluster. Amazon is continuously working hard on improving the service features but unfortunately, at this moment AWS doesn't allow clients to connect to the individual nodes of the cluster. Instead, you can connect using the URL"

You need to turn off node discovery in the Jest client somehow: ClientConfig clientConfig = new ClientConfig.Builder("http://localhost:9200").discoveryEnabled(false)

See https://github.com/searchbox-io/Jest/blob/master/jest/README.md#node-discovery-through-nodes-api