My goal is to do insert and update multiple documents in ElasticSearch using ElasticsearchRepository
.
public interface EmployeeInfoRepository extends ElasticsearchRepository<EmployeeInfo, String> {
}
However, whenever I call saveAll(entities)
, the number of document is unchanged but it creates new indexes for those entities.
employeeInfoRepository.saveAll(employeeInfos);
If I insert 1000 elements, at first it will have 1000 docs and 1000 indexes, which is what I expected. Then I call saveAll
two more times, it still has 1000 docs but now the number of indexes increases to 3000.
How can I update it properly?
It would be the best if it's just as easy as calling saveAll
and the rest is handled by SpringBootData ElasticSearch.
CodePudding user response:
Turns out the index_total
just count the number of indexed items. The main thing here is the storage size
keeps increasing after each saveAll
. At this point I have some assumptions:
- Because of the snapshot for each document
- Because requests are cached
CodePudding user response:
The size of the indices
directory actually keeps increasing, now I need to know how the inverted index are stored.