Category : elastic-search

summarize Internal factors The consistency of es mainly has two aspects: Refresh Problem Caused by lucene Index Mechanism Replica consistency problems caused by fragmentation and replication (consistency:one、all、quorum) external factor External factors, that is, if the synchronization mechanism of db and es is used, there will be a certain delay in synchronization here, and there may ..

Read more

Example MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder(“app”,app); SearchQuery query = new NativeSearchQueryBuilder() .withIndices(index) .withTypes(type) .withQuery(matchQueryBuilder) .withPageable(page) .build(); long scollTimeInMillis = 1000; String scrollId = elasticsearchTemplate.scan(query, scollTimeInMillis, false); boolean hasRecords = true; long totalCount = 0; while (hasRecords) { Page<LogDetail> page = elasticsearchTemplate.scroll(scrollId, scollTimeInMillis, LogDetail.class); if (page.hasContent()) { LOGGER.info(“page number:{}”,page.getNumberOfElements()); totalCount += page.getNumberOfElements(); } else { hasRecords ..

Read more