【发布时间】:2015-09-22 11:39:35
【问题描述】:
我想制作一个应用程序,在其中使用 Spring-Boot 在 ElasticSearch 的现有索引中搜索文档。我在文档中搜索我没有找到有关连接到现有索引的任何信息。请问有什么帮助吗?
【问题讨论】:
标签: elasticsearch spring-boot spring-data-elasticsearch
我想制作一个应用程序,在其中使用 Spring-Boot 在 ElasticSearch 的现有索引中搜索文档。我在文档中搜索我没有找到有关连接到现有索引的任何信息。请问有什么帮助吗?
【问题讨论】:
标签: elasticsearch spring-boot spring-data-elasticsearch
你应该看看 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;
// …
}
【讨论】: