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

io.polyglotted.elastic.search.ResponseBuilder Maven / Gradle / Ivy

There is a newer version: 6.8.5
Show newest version
package io.polyglotted.elastic.search;

import io.polyglotted.elastic.common.DocResult;
import io.polyglotted.elastic.common.Verbose;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.search.SearchResponse;

import java.util.List;

import static io.polyglotted.common.util.CollUtil.transform;
import static io.polyglotted.elastic.search.SearchUtil.hitSource;

@SuppressWarnings("unused")
public interface ResponseBuilder {
    List buildFrom(SearchResponse response, Verbose verbose);

    ResponseBuilder DeleteReqBuilder = (resp, v) -> transform(resp.getHits(),
        h -> new DeleteRequest(h.getIndex(), h.getType(), h.getId())).toList();
    ResponseBuilder DocResultBuilder = (resp, v) -> transform(resp.getHits(),
        h -> new DocResult(h.getId(), hitSource(h))).toList();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy