【问题标题】:Spring-Boot : Searching in existing Index in ElasticSearchSpring-Boot:在 ElasticSearch 中的现有索引中搜索
【发布时间】:2015-09-22 11:39:35
【问题描述】:

我想制作一个应用程序,在其中使用 Spring-Boot 在 ElasticSearch 的现有索引中搜索文档。我在文档中搜索我没有找到有关连接到现有索引的任何信息。请问有什么帮助吗?

【问题讨论】:

    标签: elasticsearch spring-boot spring-data-elasticsearch


    【解决方案1】:

    你应该看看 docs.spring.io/spring-data/elasticsearch/docs/current/reference/...。您可以通过使用 @Document 将参数 indexName 与您要使用的索引的名称来注释您的实体来定义要访问的索引。

    @Document(indexName = "people")
    public class Person {
    
        @Id
        private String id;
    
        private String firstName;
    
        private String lastName;
    
        // …
    }
    

    【讨论】:

      猜你喜欢
      • 2019-06-14
      • 2022-06-18
      • 1970-01-01
      • 2022-12-20
      • 2016-11-26
      • 2018-08-01
      • 2017-12-17
      • 2015-08-02
      • 2015-09-22
      相关资源
      最近更新 更多