ElasticsearchOperations查询方法解析

	/**
	 *  1. 根据条件查询
	 * Execute the criteria query against elasticsearch and return result as {@link List}
	 *
	 * @param query 字段名称逻辑拼接字段的值,支持排序和分页
	 * @param clazz
	 * @param 
	 * @return
	 */
	 List queryForList(CriteriaQuery query, Class clazz);

	/**
	 *  2. 根据字符串查询
	 * Execute the string query against elasticsearch and return result as {@link List}
	 *
	 * @param query
	 * @param clazz
	 * @param 
	 * @return
	 */
	 List queryForList(StringQuery query, Class clazz);

	/**
	 *  3. 根据搜索查询
	 * Execute the search query against elasticsearch and return result as {@link List}
	 *
	 * @param query
	 * @param clazz
	 * @param 
	 * @return
	 */
	 List queryForList(SearchQuery query, Class clazz);

	/**
	 *  4. 根据多搜索查询
	 *    一个接口默认方法,实现类可以调用
	 * Execute the multi search query against elasticsearch and return result as {@link List}
	 *
	 * @param queries
	 * @param clazz
	 * @param 
	 * @return
	 */
	default  List> queryForList(List queries, Class clazz) {
		return queryForPage(queries, clazz).stream().map(Page::getContent).collect(Collectors.toList());
	}
	
	/**
	 * 5. 通过ids,批量查询
	 * Execute a multiGet against elasticsearch for the given ids
	 *
	 * @param searchQuery
	 * @param clazz
	 * @return
	 */
	 List multiGet(SearchQuery searchQuery, Class clazz);

	/**
	 * 6. 通过ids和查询条件,批量查询
	 * Execute a multiGet against elasticsearch for the given ids with MultiGetResultMapper
	 *
	 * @param searchQuery
	 * @param clazz
	 * @param multiGetResultMapper
	 * @return
	 */
	 List multiGet(SearchQuery searchQuery, Class clazz, MultiGetResultMapper multiGetResultMapper);

你可能感兴趣的:(elasticsearch,Elasticsearch,Operations,查询方法解析)