Search in sources :

Example 11 with QueryVariant

use of co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant in project para-search-elasticsearch by Erudika.

the class ES method getCountInternal.

public static Long getCountInternal(String appid, String type, Map<String, ?> terms) {
    if (StringUtils.isBlank(appid) || terms == null || terms.isEmpty()) {
        return 0L;
    }
    Long count = 0L;
    QueryVariant query = getTermsQuery(terms, true);
    if (query != null) {
        if (!StringUtils.isBlank(type)) {
            query = QueryBuilders.bool().must(query._toQuery(), QueryBuilders.term().field(Config._TYPE).value(v -> v.stringValue(type)).build()._toQuery()).build();
        }
        try {
            Query q = query._toQuery();
            count = getRESTClient().count(b -> b.index(getIndexName(appid)).query(q)).count();
        } catch (Exception e) {
            Throwable cause = e.getCause();
            String msg = cause != null ? cause.getMessage() : e.getMessage();
            logger.warn("Could not count results in index '{}': {}", appid, msg);
        }
    }
    return count;
}
Also used : Arrays(java.util.Arrays) BulkOperation(co.elastic.clients.elasticsearch.core.bulk.BulkOperation) Like(co.elastic.clients.elasticsearch._types.query_dsl.Like) ESUtils.getNestedKey(com.erudika.para.server.search.es.ESUtils.getNestedKey) LoggerFactory(org.slf4j.LoggerFactory) TotalHitsRelation(co.elastic.clients.elasticsearch.core.search.TotalHitsRelation) ESUtils.getRESTClient(com.erudika.para.server.search.es.ESUtils.getRESTClient) StringUtils(org.apache.commons.lang3.StringUtils) ESUtils.qs(com.erudika.para.server.search.es.ESUtils.qs) ESUtils.convertQueryStringToNestedQuery(com.erudika.para.server.search.es.ESUtils.convertQueryStringToNestedQuery) PROPS_PREFIX(com.erudika.para.server.search.es.ESUtils.PROPS_PREFIX) Map(java.util.Map) FieldValue(co.elastic.clients.elasticsearch._types.FieldValue) ESUtils.getTermsQuery(com.erudika.para.server.search.es.ESUtils.getTermsQuery) Config(com.erudika.para.core.utils.Config) ParaObject(com.erudika.para.core.ParaObject) GetResponse(co.elastic.clients.elasticsearch.core.GetResponse) ESUtils.nestedMode(com.erudika.para.server.search.es.ESUtils.nestedMode) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Tag(com.erudika.para.core.Tag) ESUtils.executeRequests(com.erudika.para.server.search.es.ESUtils.executeRequests) Optional(java.util.Optional) Para(com.erudika.para.core.utils.Para) QueryBuilders(co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders) App(com.erudika.para.core.App) SearchRequest(co.elastic.clients.elasticsearch.core.SearchRequest) SearchResponse(co.elastic.clients.elasticsearch.core.SearchResponse) SearchType(co.elastic.clients.elasticsearch._types.SearchType) ESUtils.getPager(com.erudika.para.server.search.es.ESUtils.getPager) HashMap(java.util.HashMap) ChildScoreMode(co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode) Pager(com.erudika.para.core.utils.Pager) ArrayList(java.util.ArrayList) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) TotalHits(co.elastic.clients.elasticsearch.core.search.TotalHits) DAO(com.erudika.para.core.persistence.DAO) LinkedList(java.util.LinkedList) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery) ESUtils.nestedPropsQuery(com.erudika.para.server.search.es.ESUtils.nestedPropsQuery) Logger(org.slf4j.Logger) SortOrder(co.elastic.clients.elasticsearch._types.SortOrder) Address(com.erudika.para.core.Address) ESUtils.getValueFieldName(com.erudika.para.server.search.es.ESUtils.getValueFieldName) ESUtils.getIndexName(com.erudika.para.server.search.es.ESUtils.getIndexName) Utils(com.erudika.para.core.utils.Utils) TimeUnit(java.util.concurrent.TimeUnit) Hit(co.elastic.clients.elasticsearch.core.search.Hit) Query(co.elastic.clients.elasticsearch._types.query_dsl.Query) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) SortOptions(co.elastic.clients.elasticsearch._types.SortOptions) Collections(java.util.Collections) ESUtils.convertQueryStringToNestedQuery(com.erudika.para.server.search.es.ESUtils.convertQueryStringToNestedQuery) ESUtils.getTermsQuery(com.erudika.para.server.search.es.ESUtils.getTermsQuery) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery) ESUtils.nestedPropsQuery(com.erudika.para.server.search.es.ESUtils.nestedPropsQuery) Query(co.elastic.clients.elasticsearch._types.query_dsl.Query) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant)

Example 12 with QueryVariant

use of co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant in project para-search-elasticsearch by Erudika.

the class ES method findTermInListInternal.

public static <P extends ParaObject> List<P> findTermInListInternal(String appid, String type, String field, List<?> terms, Pager... pager) {
    if (StringUtils.isBlank(field) || terms == null) {
        return Collections.emptyList();
    }
    QueryVariant qb;
    if (nestedMode() && field.startsWith(PROPS_PREFIX)) {
        QueryVariant bfb = null;
        BoolQuery.Builder fb = QueryBuilders.bool();
        for (Object term : terms) {
            bfb = keyValueBoolQuery(field, String.valueOf(term));
            fb.should(bfb._toQuery());
        }
        qb = (QueryVariant) nestedPropsQuery(terms.size() > 1 ? fb.build() : bfb).build();
    } else {
        List<FieldValue> values = terms.stream().filter(Objects::nonNull).map(v -> FieldValue.of(fv -> fv.stringValue(v.toString()))).collect(Collectors.toList());
        qb = QueryBuilders.terms().field(field).terms(t -> t.value(values)).build();
    }
    return searchQuery(appid, type, qb, pager);
}
Also used : Arrays(java.util.Arrays) BulkOperation(co.elastic.clients.elasticsearch.core.bulk.BulkOperation) Like(co.elastic.clients.elasticsearch._types.query_dsl.Like) ESUtils.getNestedKey(com.erudika.para.server.search.es.ESUtils.getNestedKey) LoggerFactory(org.slf4j.LoggerFactory) TotalHitsRelation(co.elastic.clients.elasticsearch.core.search.TotalHitsRelation) ESUtils.getRESTClient(com.erudika.para.server.search.es.ESUtils.getRESTClient) StringUtils(org.apache.commons.lang3.StringUtils) ESUtils.qs(com.erudika.para.server.search.es.ESUtils.qs) ESUtils.convertQueryStringToNestedQuery(com.erudika.para.server.search.es.ESUtils.convertQueryStringToNestedQuery) PROPS_PREFIX(com.erudika.para.server.search.es.ESUtils.PROPS_PREFIX) Map(java.util.Map) FieldValue(co.elastic.clients.elasticsearch._types.FieldValue) ESUtils.getTermsQuery(com.erudika.para.server.search.es.ESUtils.getTermsQuery) Config(com.erudika.para.core.utils.Config) ParaObject(com.erudika.para.core.ParaObject) GetResponse(co.elastic.clients.elasticsearch.core.GetResponse) ESUtils.nestedMode(com.erudika.para.server.search.es.ESUtils.nestedMode) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Tag(com.erudika.para.core.Tag) ESUtils.executeRequests(com.erudika.para.server.search.es.ESUtils.executeRequests) Optional(java.util.Optional) Para(com.erudika.para.core.utils.Para) QueryBuilders(co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders) App(com.erudika.para.core.App) SearchRequest(co.elastic.clients.elasticsearch.core.SearchRequest) SearchResponse(co.elastic.clients.elasticsearch.core.SearchResponse) SearchType(co.elastic.clients.elasticsearch._types.SearchType) ESUtils.getPager(com.erudika.para.server.search.es.ESUtils.getPager) HashMap(java.util.HashMap) ChildScoreMode(co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode) Pager(com.erudika.para.core.utils.Pager) ArrayList(java.util.ArrayList) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) TotalHits(co.elastic.clients.elasticsearch.core.search.TotalHits) DAO(com.erudika.para.core.persistence.DAO) LinkedList(java.util.LinkedList) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery) ESUtils.nestedPropsQuery(com.erudika.para.server.search.es.ESUtils.nestedPropsQuery) Logger(org.slf4j.Logger) SortOrder(co.elastic.clients.elasticsearch._types.SortOrder) Address(com.erudika.para.core.Address) ESUtils.getValueFieldName(com.erudika.para.server.search.es.ESUtils.getValueFieldName) ESUtils.getIndexName(com.erudika.para.server.search.es.ESUtils.getIndexName) Utils(com.erudika.para.core.utils.Utils) TimeUnit(java.util.concurrent.TimeUnit) Hit(co.elastic.clients.elasticsearch.core.search.Hit) Query(co.elastic.clients.elasticsearch._types.query_dsl.Query) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) SortOptions(co.elastic.clients.elasticsearch._types.SortOptions) Collections(java.util.Collections) Objects(java.util.Objects) ParaObject(com.erudika.para.core.ParaObject) FieldValue(co.elastic.clients.elasticsearch._types.FieldValue) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery)

Example 13 with QueryVariant

use of co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant in project para-search-elasticsearch by Erudika.

the class ES method findSimilarInternal.

public static <P extends ParaObject> List<P> findSimilarInternal(String appid, String type, String filterKey, String[] fields, String liketext, Pager... pager) {
    if (StringUtils.isBlank(liketext)) {
        return Collections.emptyList();
    }
    QueryVariant qb;
    String matchPercent = "70%";
    if (fields == null || fields.length == 0) {
        qb = QueryBuilders.moreLikeThis().like(l -> l.text(liketext)).minDocFreq(1).minTermFreq(1).minimumShouldMatch(matchPercent).build();
    } else {
        boolean containsNestedProps = Arrays.stream(fields).anyMatch((f) -> StringUtils.startsWith(f, PROPS_PREFIX));
        if (nestedMode() && containsNestedProps) {
            BoolQuery.Builder bqb = QueryBuilders.bool();
            for (String field : fields) {
                QueryVariant kQuery = QueryBuilders.match().field(PROPS_PREFIX + "k").query(v -> v.stringValue(getNestedKey(field))).build();
                QueryVariant vQuery = QueryBuilders.moreLikeThis().fields(PROPS_PREFIX + "v").like(Like.of(l -> l.text(liketext))).minDocFreq(1).minTermFreq(1).minimumShouldMatch(matchPercent).build();
                QueryVariant nested = (QueryVariant) nestedPropsQuery(QueryBuilders.bool().must(kQuery._toQuery(), vQuery._toQuery()).build()).build();
                bqb.should(nested._toQuery());
            }
            qb = bqb.build();
        } else {
            qb = QueryBuilders.moreLikeThis().fields(Arrays.asList(fields)).like(l -> l.text(liketext)).minDocFreq(1).minTermFreq(1).minimumShouldMatch(matchPercent).build();
        }
    }
    if (!StringUtils.isBlank(filterKey)) {
        qb = QueryBuilders.bool().mustNot(QueryBuilders.term().field(Config._ID).value(v -> v.stringValue(filterKey)).build()._toQuery()).filter(qb._toQuery()).build();
    }
    return searchQuery(appid, searchQueryRaw(appid, type, qb, pager));
}
Also used : Arrays(java.util.Arrays) BulkOperation(co.elastic.clients.elasticsearch.core.bulk.BulkOperation) Like(co.elastic.clients.elasticsearch._types.query_dsl.Like) ESUtils.getNestedKey(com.erudika.para.server.search.es.ESUtils.getNestedKey) LoggerFactory(org.slf4j.LoggerFactory) TotalHitsRelation(co.elastic.clients.elasticsearch.core.search.TotalHitsRelation) ESUtils.getRESTClient(com.erudika.para.server.search.es.ESUtils.getRESTClient) StringUtils(org.apache.commons.lang3.StringUtils) ESUtils.qs(com.erudika.para.server.search.es.ESUtils.qs) ESUtils.convertQueryStringToNestedQuery(com.erudika.para.server.search.es.ESUtils.convertQueryStringToNestedQuery) PROPS_PREFIX(com.erudika.para.server.search.es.ESUtils.PROPS_PREFIX) Map(java.util.Map) FieldValue(co.elastic.clients.elasticsearch._types.FieldValue) ESUtils.getTermsQuery(com.erudika.para.server.search.es.ESUtils.getTermsQuery) Config(com.erudika.para.core.utils.Config) ParaObject(com.erudika.para.core.ParaObject) GetResponse(co.elastic.clients.elasticsearch.core.GetResponse) ESUtils.nestedMode(com.erudika.para.server.search.es.ESUtils.nestedMode) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Tag(com.erudika.para.core.Tag) ESUtils.executeRequests(com.erudika.para.server.search.es.ESUtils.executeRequests) Optional(java.util.Optional) Para(com.erudika.para.core.utils.Para) QueryBuilders(co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders) App(com.erudika.para.core.App) SearchRequest(co.elastic.clients.elasticsearch.core.SearchRequest) SearchResponse(co.elastic.clients.elasticsearch.core.SearchResponse) SearchType(co.elastic.clients.elasticsearch._types.SearchType) ESUtils.getPager(com.erudika.para.server.search.es.ESUtils.getPager) HashMap(java.util.HashMap) ChildScoreMode(co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode) Pager(com.erudika.para.core.utils.Pager) ArrayList(java.util.ArrayList) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) TotalHits(co.elastic.clients.elasticsearch.core.search.TotalHits) DAO(com.erudika.para.core.persistence.DAO) LinkedList(java.util.LinkedList) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery) ESUtils.nestedPropsQuery(com.erudika.para.server.search.es.ESUtils.nestedPropsQuery) Logger(org.slf4j.Logger) SortOrder(co.elastic.clients.elasticsearch._types.SortOrder) Address(com.erudika.para.core.Address) ESUtils.getValueFieldName(com.erudika.para.server.search.es.ESUtils.getValueFieldName) ESUtils.getIndexName(com.erudika.para.server.search.es.ESUtils.getIndexName) Utils(com.erudika.para.core.utils.Utils) TimeUnit(java.util.concurrent.TimeUnit) Hit(co.elastic.clients.elasticsearch.core.search.Hit) Query(co.elastic.clients.elasticsearch._types.query_dsl.Query) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) SortOptions(co.elastic.clients.elasticsearch._types.SortOptions) Collections(java.util.Collections) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery)

Example 14 with QueryVariant

use of co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant in project para-search-elasticsearch by Erudika.

the class ES method searchQueryRaw.

/**
 * Executes an ElasticSearch query. This is the core method of the class.
 * @param appid name of the {@link com.erudika.para.core.App}
 * @param type type of object
 * @param query the search query builder
 * @param pager a {@link com.erudika.para.core.utils.Pager}
 * @return a list of search results
 */
protected static SearchResponse<Map> searchQueryRaw(String appid, String type, QueryVariant query, Pager... pager) {
    if (StringUtils.isBlank(appid)) {
        return null;
    }
    Pager page = ESUtils.getPager(pager);
    SortOrder order = page.isDesc() ? SortOrder.Desc : SortOrder.Asc;
    int max = page.getLimit();
    int pageNum = (int) page.getPage();
    int start = (pageNum < 1 || pageNum > Para.getConfig().maxPages()) ? 0 : (pageNum - 1) * max;
    if (query == null) {
        query = QueryBuilders.matchAll().build();
    }
    if (!StringUtils.isBlank(type)) {
        query = QueryBuilders.bool().must(query._toQuery(), QueryBuilders.term().field(Config._TYPE).value(v -> v.stringValue(type)).build()._toQuery()).build();
    }
    SearchResponse<Map> hits = null;
    String debugQuery = "";
    try {
        SearchRequest.Builder search = new SearchRequest.Builder();
        search.index(getIndexName(appid)).searchType(SearchType.DfsQueryThenFetch).query(query._toQuery()).size(max).trackTotalHits(ESUtils.getTrackTotalHits());
        if (pageNum <= 1 && !StringUtils.isBlank(page.getLastKey())) {
            search.searchAfter(page.getLastKey());
            search.from(0);
            search.sort(SortOptions.of(b -> b.field(f -> f.field("_docid").order(order))));
        } else {
            search.from(start);
            for (SortOptions sortField : ESUtils.getSortFieldsFromPager(page)) {
                search.sort(sortField);
            }
        }
        debugQuery = search.toString();
        logger.debug("Elasticsearch query: {}", debugQuery);
        hits = getRESTClient().search(search.build(), Map.class);
        page.setCount(Optional.ofNullable(hits.hits().total()).orElse(TotalHits.of(t -> t.relation(TotalHitsRelation.Eq).value(page.getCount()))).value());
        if (hits.hits().hits().size() > 0) {
            Object id = hits.hits().hits().get(hits.hits().hits().size() - 1).source().get("_docid");
            if (id != null) {
                page.setLastKey(id.toString());
            }
        }
    } catch (Exception e) {
        Throwable cause = e.getCause();
        String msg = cause != null ? cause.getMessage() : e.getMessage();
        logger.debug("No search results for type '{}' in app '{}': {}.\nQuery: {}", type, appid, msg, debugQuery);
    }
    return hits;
}
Also used : Arrays(java.util.Arrays) BulkOperation(co.elastic.clients.elasticsearch.core.bulk.BulkOperation) Like(co.elastic.clients.elasticsearch._types.query_dsl.Like) ESUtils.getNestedKey(com.erudika.para.server.search.es.ESUtils.getNestedKey) LoggerFactory(org.slf4j.LoggerFactory) TotalHitsRelation(co.elastic.clients.elasticsearch.core.search.TotalHitsRelation) ESUtils.getRESTClient(com.erudika.para.server.search.es.ESUtils.getRESTClient) StringUtils(org.apache.commons.lang3.StringUtils) ESUtils.qs(com.erudika.para.server.search.es.ESUtils.qs) ESUtils.convertQueryStringToNestedQuery(com.erudika.para.server.search.es.ESUtils.convertQueryStringToNestedQuery) PROPS_PREFIX(com.erudika.para.server.search.es.ESUtils.PROPS_PREFIX) Map(java.util.Map) FieldValue(co.elastic.clients.elasticsearch._types.FieldValue) ESUtils.getTermsQuery(com.erudika.para.server.search.es.ESUtils.getTermsQuery) Config(com.erudika.para.core.utils.Config) ParaObject(com.erudika.para.core.ParaObject) GetResponse(co.elastic.clients.elasticsearch.core.GetResponse) ESUtils.nestedMode(com.erudika.para.server.search.es.ESUtils.nestedMode) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Tag(com.erudika.para.core.Tag) ESUtils.executeRequests(com.erudika.para.server.search.es.ESUtils.executeRequests) Optional(java.util.Optional) Para(com.erudika.para.core.utils.Para) QueryBuilders(co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders) App(com.erudika.para.core.App) SearchRequest(co.elastic.clients.elasticsearch.core.SearchRequest) SearchResponse(co.elastic.clients.elasticsearch.core.SearchResponse) SearchType(co.elastic.clients.elasticsearch._types.SearchType) ESUtils.getPager(com.erudika.para.server.search.es.ESUtils.getPager) HashMap(java.util.HashMap) ChildScoreMode(co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode) Pager(com.erudika.para.core.utils.Pager) ArrayList(java.util.ArrayList) ESUtils.keyValueBoolQuery(com.erudika.para.server.search.es.ESUtils.keyValueBoolQuery) TotalHits(co.elastic.clients.elasticsearch.core.search.TotalHits) DAO(com.erudika.para.core.persistence.DAO) LinkedList(java.util.LinkedList) BoolQuery(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery) ESUtils.nestedPropsQuery(com.erudika.para.server.search.es.ESUtils.nestedPropsQuery) Logger(org.slf4j.Logger) SortOrder(co.elastic.clients.elasticsearch._types.SortOrder) Address(com.erudika.para.core.Address) ESUtils.getValueFieldName(com.erudika.para.server.search.es.ESUtils.getValueFieldName) ESUtils.getIndexName(com.erudika.para.server.search.es.ESUtils.getIndexName) Utils(com.erudika.para.core.utils.Utils) TimeUnit(java.util.concurrent.TimeUnit) Hit(co.elastic.clients.elasticsearch.core.search.Hit) Query(co.elastic.clients.elasticsearch._types.query_dsl.Query) QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant) SortOptions(co.elastic.clients.elasticsearch._types.SortOptions) Collections(java.util.Collections) SearchRequest(co.elastic.clients.elasticsearch.core.SearchRequest) SortOrder(co.elastic.clients.elasticsearch._types.SortOrder) ESUtils.getPager(com.erudika.para.server.search.es.ESUtils.getPager) Pager(com.erudika.para.core.utils.Pager) ParaObject(com.erudika.para.core.ParaObject) Map(java.util.Map) HashMap(java.util.HashMap) SortOptions(co.elastic.clients.elasticsearch._types.SortOptions)

Example 15 with QueryVariant

use of co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant in project para-search-elasticsearch by Erudika.

the class ESUtils method term.

private static ObjectBuilder<?> term(Query q) {
    ObjectBuilder<?> qb;
    String field = ((org.apache.lucene.search.TermQuery) q).getTerm().field();
    String value = ((org.apache.lucene.search.TermQuery) q).getTerm().text();
    if (StringUtils.isBlank(field)) {
        QueryVariant kQuery = QueryBuilders.matchAll().build();
        QueryVariant vQuery = QueryBuilders.multiMatch().query(value).build();
        QueryVariant nested = (QueryVariant) nestedPropsQuery(QueryBuilders.bool().must(kQuery._toQuery(), vQuery._toQuery()).build()).build();
        qb = QueryBuilders.bool().should(nested._toQuery(), QueryBuilders.multiMatch().query(value).build()._toQuery());
    } else if (field.matches(PROPS_REGEX)) {
        qb = nestedPropsQuery(keyValueBoolQuery(field, value));
    } else {
        qb = QueryBuilders.term().field(field).value(v -> v.stringValue(value));
    }
    return qb;
}
Also used : QueryVariant(co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant)

Aggregations

QueryVariant (co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant)15 BoolQuery (co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery)12 ParaObject (com.erudika.para.core.ParaObject)11 FieldValue (co.elastic.clients.elasticsearch._types.FieldValue)10 SortOptions (co.elastic.clients.elasticsearch._types.SortOptions)10 SortOrder (co.elastic.clients.elasticsearch._types.SortOrder)10 ChildScoreMode (co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode)10 QueryBuilders (co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders)10 BulkOperation (co.elastic.clients.elasticsearch.core.bulk.BulkOperation)10 App (com.erudika.para.core.App)10 DAO (com.erudika.para.core.persistence.DAO)10 Config (com.erudika.para.core.utils.Config)10 Pager (com.erudika.para.core.utils.Pager)10 Para (com.erudika.para.core.utils.Para)10 Utils (com.erudika.para.core.utils.Utils)10 ArrayList (java.util.ArrayList)10 SearchType (co.elastic.clients.elasticsearch._types.SearchType)7 Like (co.elastic.clients.elasticsearch._types.query_dsl.Like)7 Query (co.elastic.clients.elasticsearch._types.query_dsl.Query)7 HashMap (java.util.HashMap)7