use of org.elasticsearch.index.query.QueryStringQueryBuilder in project graylog2-server by Graylog2.
the class Searches method histogram.
public HistogramResult histogram(String query, DateHistogramInterval interval, String filter, TimeRange range) {
FilterAggregationBuilder builder = AggregationBuilders.filter(AGG_FILTER).subAggregation(AggregationBuilders.dateHistogram(AGG_HISTOGRAM).field("timestamp").interval(interval.toESInterval())).filter(standardAggregationFilters(range, filter));
QueryStringQueryBuilder qs = queryStringQuery(query);
qs.allowLeadingWildcard(configuration.isAllowLeadingWildcardSearches());
final Set<String> affectedIndices = determineAffectedIndices(range, filter);
final SearchRequestBuilder srb = c.prepareSearch(affectedIndices.toArray(new String[affectedIndices.size()])).setIndicesOptions(IndicesOptions.lenientExpandOpen()).setQuery(qs).addAggregation(builder);
final SearchRequest request = srb.request();
SearchResponse r = c.search(request).actionGet();
recordEsMetrics(r, range);
final Filter f = r.getAggregations().get(AGG_FILTER);
return new DateHistogramResult(f.getAggregations().get(AGG_HISTOGRAM), query, request.source(), interval, r.getTook());
}
use of org.elasticsearch.index.query.QueryStringQueryBuilder in project fess by codelibs.
the class EsAbstractConditionQuery method doQueryString.
protected void doQueryString(String queryString, ConditionOptionCall<QueryStringQueryBuilder> opLambda) {
QueryStringQueryBuilder queryStringQuery = QueryBuilders.queryStringQuery(queryString);
regQ(queryStringQuery);
if (opLambda != null) {
opLambda.callback(queryStringQuery);
}
}
Aggregations