Spring boot 如何在spring data elasticsearch中创建索引后更新索引设置
我正在使用SpringDataElasticSearch编写SpringBoot应用程序。我有一个entity类,可以在elasticsearch中自动创建索引。但是我想定义一个分析器并将其设置为一个字段 我期待类似回调的东西来支持这一点。现在使用@Document创建索引Spring boot 如何在spring data elasticsearch中创建索引后更新索引设置,spring-boot,
spring-data-elasticsearch,Spring Boot,
spring Data Elasticsearch,我正在使用SpringDataElasticSearch编写SpringBoot应用程序。我有一个entity类,可以在elasticsearch中自动创建索引。但是我想定义一个分析器并将其设置为一个字段 我期待类似回调的东西来支持这一点。现在使用@Document创建索引 @Document(indexName = "products", shards = 1, versionType = VersionType.INTERNAL, createIndex = true)
@Document(indexName = "products", shards = 1, versionType = VersionType.INTERNAL, createIndex = true)
您可以禁用自动索引创建,也可以使用
IndexOperations.create(文档设置)
方法自己创建索引。文档
或者在类路径上的json文件中提供设置,并用@Setting
注释引用它。作为参考,请检查此