I am using elasticsearch for my application and this the domain entity
@Document(indexName = "bookstore", type = "book", refreshInterval = "-1")
public class Book {
@Id
@Column(name = "ID")
private Long id;
@Column(name = "NAME")
@Field(type=FieldType.String)
private String name;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "PRICE")
private Double price;
This is the config file
@Configuration
@EnableElasticsearchRepositories(basePackages =
"elasticsearch.repo")
public class BookSearchRepositoryTestConfig {
@Bean
public ElasticsearchOperations elasticsearchTemplate() throws IOException {
return new ElasticsearchTemplate(nodeBuilder()
.loadConfigSettings(false)
.local(true)
.settings(
ImmutableSettings.settingsBuilder()
.put("index.store.type", "memory")
.put("index.number_of_shards", 1)
.put("index.number_of_replicas", 0).build()
).node().client());
}
This settings doesnt work.It use defualt settings and create 5 shards.
I know this can done by using @Document
@Document(indexName = "bookstore", type = "book", shards = 1, replicas = 0, indexStoreType = "memory", refreshInterval = "-1")
or using @Setting
@Setting(settingPath = "/settings/elasticsearch-settings.json")
But I am tring to use the config file and set the properties. Please guide me to solve this issue.