티스토리 뷰

728x90
반응형

참조: https://www.codetd.com/en/article/12190266

 

Elasticsearch uses collapse to de-duplicate content - Code World

Using cardinality to de- duplicate statistics. Generally, we use elasticsearch to de-duplicate statistical results by using cardinality in the aggregation. For example, there is a field "one_account.one_account_no", and the value of "one_account.one_accoun

www.codetd.com

 

소스 빌더에 collapse 추가

sourceBuilder = new SearchSourceBuilder()
					.query(query)
					.from(from)
					.size(menuSize)
					.sort(SortBuilders.fieldSort("useDate").order(SortOrder.DESC))
					.collapse(new CollapseBuilder("test"))
					.fetchSource(includeFields, excludeFields)
					.explain(false);
                    
test 라는 이름의 필드를 기준으로 중복 제거됨

 

728x90
반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함