All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.es.plus.adapter.params.EsResponse Maven / Gradle / Ivy

There is a newer version: 0.3.941
Show newest version
package com.es.plus.adapter.params;


import lombok.Data;
import org.elasticsearch.action.search.ShardSearchFailure;
import org.elasticsearch.search.profile.ProfileShardResult;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;


@Data
public class EsResponse {
    
    /**
     * 总数
     */
    private long total;
    
    /**
     * 耗时  注意,不是es返回的,而是系统统计的
     */
    private long tookInMillis;
    
    /**
     * 数据集合
     */
    private List list;
    
    /**
     * 聚合结果
     */
    private EsAggResponse esAggsResponse;
    
    /**
     * 分析结果
     */
    private Map profileResults;
    
    /**
     * SearchAfter搜索查询起始值
     */
    private Object[] firstSortValues;
    
    /**
     * SearchAfter搜索查询结束值
     */
    private Object[] tailSortValues;
    
    /**
     * 内部嵌套对象
     */
    private EsHits innerHits;
    
    /**
     * 滚动id
     */
    private String scrollId;
    
    /**
     * 查询的总分片
     */
    private int totalShards;
    
    /**
     * 成功的分片
     */
    private int successfulShards;
    
    /**
     * 跳过的分片
     */
    private int skippedShards;
    
    /**
     * 分片失败的信息
     */
    private ShardSearchFailure[] shardFailures;
    
    
    public EsResponse(List list, long count, EsAggResponse esAggregationReponse) {
        this.list = list;
        this.total = count;
        this.esAggsResponse = esAggregationReponse;
    }
    
    public T getOne() {
        return CollectionUtils.isEmpty(list) ? null : list.get(0);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy