Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎专栏 | Search | About

21.7. Filter 过滤

		
FilterBuilder filterBuilder = FilterBuilders.andFilter(  
	FilterBuilders.existsFilter("title").filterName("exist"),  
	FilterBuilders.termFilter("title", "elastic")  
);  

SearchResponse response = client.prepareSearch("netkiller")  
	.setPostFilter(filterBuilder)  
	.get();  
		
		

21.7.1. term

			
.setPostFilter(QueryBuilders.termQuery("site_id", siteId))
			
			

21.7.2. range

			
QueryBuilders.rangeQuery("age").from(12).to(18)