本文整理汇总了Java中org.elasticsearch.search.profile.SearchProfileShardResults类的典型用法代码示例。如果您正苦于以下问题:Java SearchProfileShardResults类的具体用法?Java SearchProfileShardResults怎么用?Java SearchProfileShardResults使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SearchProfileShardResults类属于org.elasticsearch.search.profile包,在下文中一共展示了SearchProfileShardResults类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReducedQueryPhase
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
ReducedQueryPhase(long totalHits, long fetchHits, float maxScore, boolean timedOut, Boolean terminatedEarly,
QuerySearchResult oneResult, Suggest suggest, InternalAggregations aggregations,
SearchProfileShardResults shardResults, int numReducePhases) {
if (numReducePhases <= 0) {
throw new IllegalArgumentException("at least one reduce phase must have been applied but was: " + numReducePhases);
}
this.totalHits = totalHits;
this.fetchHits = fetchHits;
if (Float.isInfinite(maxScore)) {
this.maxScore = Float.NaN;
} else {
this.maxScore = maxScore;
}
this.timedOut = timedOut;
this.terminatedEarly = terminatedEarly;
this.oneResult = oneResult;
this.suggest = suggest;
this.aggregations = aggregations;
this.shardResults = shardResults;
this.numReducePhases = numReducePhases;
}
示例2: doExecute
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
@Override
protected void doExecute(SearchRequest request, ActionListener<SearchResponse> listener) {
listener.onResponse(new SearchResponse(new InternalSearchResponse(
new SearchHits(
new SearchHit[0], 0L, 0.0f),
new InternalAggregations(Collections.emptyList()),
new Suggest(Collections.emptyList()),
new SearchProfileShardResults(Collections.emptyMap()), false, false, 1), "", 1, 1, 0, new ShardSearchFailure[0]));
}
示例3: execute
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
@Override
public void execute(SearchContext searchContext) throws QueryPhaseExecutionException {
if (searchContext.hasOnlySuggest()) {
suggestPhase.execute(searchContext);
// TODO: fix this once we can fetch docs for suggestions
searchContext.queryResult().topDocs(
new TopDocs(0, Lucene.EMPTY_SCORE_DOCS, 0),
new DocValueFormat[0]);
return;
}
// Pre-process aggregations as late as possible. In the case of a DFS_Q_T_F
// request, preProcess is called on the DFS phase phase, this is why we pre-process them
// here to make sure it happens during the QUERY phase
aggregationPhase.preProcess(searchContext);
boolean rescore = execute(searchContext, searchContext.searcher());
if (rescore) { // only if we do a regular search
rescorePhase.execute(searchContext);
}
suggestPhase.execute(searchContext);
aggregationPhase.execute(searchContext);
if (searchContext.getProfilers() != null) {
ProfileShardResult shardResults = SearchProfileShardResults
.buildShardResults(searchContext.getProfilers());
searchContext.queryResult().profileResults(shardResults);
}
}
示例4: InternalSearchResponse
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
public InternalSearchResponse(SearchHits hits, InternalAggregations aggregations, Suggest suggest,
SearchProfileShardResults profileResults, boolean timedOut, Boolean terminatedEarly,
int numReducePhases) {
this.hits = hits;
this.aggregations = aggregations;
this.suggest = suggest;
this.profileResults = profileResults;
this.timedOut = timedOut;
this.terminatedEarly = terminatedEarly;
this.numReducePhases = numReducePhases;
}
示例5: readFrom
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
hits = SearchHits.readSearchHits(in);
if (in.readBoolean()) {
aggregations = InternalAggregations.readAggregations(in);
}
if (in.readBoolean()) {
suggest = Suggest.readSuggest(in);
}
timedOut = in.readBoolean();
terminatedEarly = in.readOptionalBoolean();
profileResults = in.readOptionalWriteable(SearchProfileShardResults::new);
numReducePhases = in.readVInt();
}
示例6: filterMaxHits
import org.elasticsearch.search.profile.SearchProfileShardResults; //导入依赖的package包/类
protected SearchResponse filterMaxHits(SearchResponse response, int maxHits) {
// We will use internal APIs here for efficiency. The plugin has restricted explicit ES compatibility
// anyway. Alternatively, we could serialize/ filter/ deserialize JSON, but this seems simpler.
SearchHits allHits = response.getHits();
SearchHit[] trimmedHits = new SearchHit[Math.min(maxHits, allHits.getHits().length)];
System.arraycopy(allHits.getHits(), 0, trimmedHits, 0, trimmedHits.length);
InternalAggregations _internalAggregations = null;
if (response.getAggregations() != null) {
_internalAggregations = new InternalAggregations(toInternal(response.getAggregations().asList()));
}
SearchHits _searchHits =
new SearchHits(trimmedHits, allHits.getTotalHits(), allHits.getMaxScore());
SearchProfileShardResults _searchProfileShardResults = new SearchProfileShardResults(response.getProfileResults());
InternalSearchResponse _searchResponse =
new InternalSearchResponse(
_searchHits,
_internalAggregations,
response.getSuggest(),
_searchProfileShardResults,
response.isTimedOut(),
response.isTerminatedEarly(),
response.getNumReducePhases());
return new SearchResponse(
_searchResponse,
response.getScrollId(),
response.getTotalShards(),
response.getSuccessfulShards(),
response.getSkippedShards(),
response.getTook().getMillis(),
response.getShardFailures(),
response.getClusters());
}