简体   繁体   English

Hibernate 使用 opendistro 搜索 6.0.2.Final

[英]Hibernate Search 6.0.2.Final with opendistro

I have a Spring Boot 2.4.2 application integrated with Hibernate Search 6.0.2.Final我有一个Spring Boot 2.4.2应用程序与Hibernate Search 6.0.2.Final集成

When using standard elasticsearch everything works fine (read/write) on persisting new entities.使用标准elasticsearch时,在持久化新实体上一切正常(读/写)。 The index also gets created as expected myindex-000001 based on the default simple index strategy.索引也会根据默认的simple索引策略按预期创建myindex-000001

However, when I switched the backend to opendistro (latest) I only see a single index created by the name myindex-write (different that the expected myindex-000001 ).但是,当我将后端切换到opendistro (最新)时,我只看到一个由名称myindex-write创建的索引(与预期的myindex-000001不同)。 The write operations work fine as expected (due to the suffix -write ), however the read operations fail with the error:写入操作按预期工作(由于后缀-write ),但是读取操作失败并出现错误:

root_cause": [
      {
        "type": "index_not_found_exception",
        "reason": "no such index [myindex-read]",
        "resource.type": "index_or_alias",
        "resource.id": "myindex-read",
        "index_uuid": "_na_",
        "index": "myindex-read"
      }
    ]

GET /_cat/aliases on opendistro show that there are no aliases for the index. opendistro 上的GET /_cat/aliases opendistro索引没有别名。

What is the best possible way to resolve this?解决此问题的最佳方法是什么? no-alias strategy shown here ? 这里显示no-alias策略? The downside of using no-alias is the lack of blue-green deployment like re-indexing.使用no-alias的缺点是缺乏像重新索引这样的蓝绿色部署。 Is custom index strategy the best way to solve this? custom索引策略是解决这个问题的最佳方法吗?

All the above issues were caused because I had set hibernate.search.schema_management.strategy to none .以上所有问题都是因为我将hibernate.search.schema_management.strategy设置为none引起的。 The indexes need to be created manually, as mentioned in the docs here需要手动创建索引,如此的文档中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM