Hibernate搜索elasticsearch模式管理NONE仍然连接到elasticsearch?

问题描述 投票:0回答:1

我正在考虑将我们的hibernate搜索实现从基于文件的lucene索引转移到elasticsearch,但我对文档感到困惑。具体来说,对于索引模式管理策略NONE:

不会创建,删除或更改索引,其映射和分析器定义。 Hibernate Search甚至不会检查索引是否已存在。

我们想要删除hibernate搜索的启动依赖(因此它不会尝试在启动时查询elasticsearch)。阅读模式管理策略表明NONE应该这样做。

但是,看一下代码的实现,我可以看到它仍然显式检查索引是否存在:

if (this.schemaManagementStrategy == IndexSchemaManagementStrategy.NONE) {
    this.schemaCreator.checkIndexExists(this.actualIndexName, this.schemaManagementExecutionOptions);
    return false;
}

我希望这不会发生。当我进入一个故意不正确的主机连接时,服务器启动仍然失败:

 Request:
========
Operation: IndicesExists
URI: registryreference
Data:
null
Response:
=========
null
    at org.hibernate.search.elasticsearch.client.impl.JestClient.executeRequest(JestClient.java:188) ~[hibernate-search-elasticsearch-5.6.5.Final.jar:5.6.5.Final]
... (omitted rest of stack) 
Caused by: java.net.ConnectException: Connection refused: connect

我们正在使用hibernate search 5.6.5和elasticsearch 2.4.6。

java elasticsearch hibernate-search
1个回答
0
投票

这是一个错误:HSEARCH-2568

它已在Hibernate Search 5.7.0.Final中修复,因此升级应该可以解决问题。但是,您必须将Hibernate ORM升级到5.2版本。如果沿着这条路走下去,我建议直接升级到Hibernate Search 5.11和ORM 5.4,这是最新版本,其中修复了一些错误。

请注意,正如@Sanne所提到的,即使Hibernate Search不向Elasticsearch集群发送查询,它仍可能会创建一个TCP连接池。也许您可以告诉我们更多关于您的用例的信息,以便我们提供帮助?

© www.soinside.com 2019 - 2024. All rights reserved.