【问题标题】:Spring Boot - Couchbase auto-index is not workingSpring Boot - Couchbase 自动索引不起作用
【发布时间】:2017-10-29 11:14:05
【问题描述】:

我已经用 spring boot 和 couchbase 实现了一个项目。

我还定义了 auto-index:true 。在 Couchbase 控制台上,我可以看到“生产视图”部分下的视图,但 coucshbase 仍然给我以下错误:

No index available on keyspace todolist that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online

那么有人可以告诉我我缺少什么吗?

谢谢

【问题讨论】:

    标签: spring-boot couchbase


    【解决方案1】:

    您可以尝试在您的 CouchbaseConfig 类中添加它。

    @Override
    @ConditionalOnMissingBean(name = BeanNames.COUCHBASE_INDEX_MANAGER)
    @Bean(name = BeanNames.COUCHBASE_INDEX_MANAGER)
    public IndexManager indexManager() {
            return new IndexManager(true, true, true);
    }
    

    希望它会有所帮助。

    【讨论】:

      【解决方案2】:

      当我在 couchbase 中对一个新存储桶运行测试时遇到了这个问题。

      @N1qlPrimaryIndexed 和 @ViewIndexed 注释似乎仅在我将 Spring Boot 应用程序作为可执行 Jar 运行时创建索引。

      【讨论】:

        【解决方案3】:

        Couchbase 不建议同时使用@N1qlPrimaryIndexed 和@ViewIndexed,它们只在开发过程中有用

        @ViewIndexed - 视图正在离开 couchbase,只有少数方法(如 deleteAll)仍在使用它们。

        您可以在此处阅读完整说明: https://docs.couchbase.com/tutorials/spring-data-indexes/spring-index.html

        【讨论】:

          猜你喜欢
          • 2018-11-05
          • 2016-06-25
          • 2021-07-15
          • 1970-01-01
          • 2017-08-10
          • 2020-08-08
          • 2016-12-02
          • 1970-01-01
          • 2020-09-24
          相关资源
          最近更新 更多