如何在 spring-data-elasticsearch 中创建索引后更新索引设置
How to update Index settings after index creation in spring-data-elasticsearch
我正在使用 spring-data-elasticsearch 编写 spring-boot 应用程序。我有一个实体 class,它会在 elasticsearch 中自动创建索引。但是我想定义一个分析器并将其设置为一个字段。
我期待回调之类的东西来支持这一点。现在使用 @Document
创建索引
@Document(indexName = "products", shards = 1, versionType = VersionType.INTERNAL, createIndex = true)
您可以禁用自动创建索引,然后使用IndexOperations.create(Document settings)
方法自行创建索引。 Document
.
或者您在类路径的 json 文件中提供设置,并使用 @Setting
注释引用它。作为参考检查此 test code
我正在使用 spring-data-elasticsearch 编写 spring-boot 应用程序。我有一个实体 class,它会在 elasticsearch 中自动创建索引。但是我想定义一个分析器并将其设置为一个字段。
我期待回调之类的东西来支持这一点。现在使用 @Document
创建索引@Document(indexName = "products", shards = 1, versionType = VersionType.INTERNAL, createIndex = true)
您可以禁用自动创建索引,然后使用IndexOperations.create(Document settings)
方法自行创建索引。 Document
.
或者您在类路径的 json 文件中提供设置,并使用 @Setting
注释引用它。作为参考检查此 test code