/** * Creates a new search response from the given merged hits. * @see #merge(boolean, ReducedQueryPhase, Collection, IntFunction) */ public InternalSearchResponse buildResponse(SearchHits hits) { return new InternalSearchResponse(hits, aggregations, suggest, shardResults, timedOut, terminatedEarly, numReducePhases); } }
public static InternalSearchResponse empty() { return new InternalSearchResponse(SearchHits.empty(), null, null, null, false, null, 1); }
/** * Creates a new search response from the given merged hits. * @see #merge(boolean, ReducedQueryPhase, Collection, IntFunction) */ public InternalSearchResponse buildResponse(SearchHits hits) { return new InternalSearchResponse(hits, aggregations, suggest, shardResults, timedOut, terminatedEarly, numReducePhases); } }
/** * Creates a new search response from the given merged hits. * @see #merge(boolean, ReducedQueryPhase, Collection, IntFunction) */ public InternalSearchResponse buildResponse(SearchHits hits) { return new InternalSearchResponse(hits, aggregations, suggest, shardResults, timedOut, terminatedEarly, numReducePhases); } }
/** * Creates a new search response from the given merged hits. * @see #merge(boolean, ReducedQueryPhase, Collection, IntFunction) */ public InternalSearchResponse buildResponse(SearchHits hits) { return new InternalSearchResponse(hits, aggregations, suggest, shardResults, timedOut, terminatedEarly, numReducePhases); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); internalResponse = new InternalSearchResponse(in); totalShards = in.readVInt(); successfulShards = in.readVInt(); int size = in.readVInt(); if (size == 0) { shardFailures = ShardSearchFailure.EMPTY_ARRAY; } else { shardFailures = new ShardSearchFailure[size]; for (int i = 0; i < shardFailures.length; i++) { shardFailures[i] = readShardSearchFailure(in); } } if (in.getVersion().onOrAfter(Version.V_6_1_0)) { clusters = new Clusters(in); } else { clusters = Clusters.EMPTY; } scrollId = in.readOptionalString(); tookInMillis = in.readVLong(); if (in.getVersion().onOrAfter(Version.V_5_6_0)) { skippedShards = in.readVInt(); } }
public static InternalSearchResponse readInternalSearchResponse(StreamInput in) throws IOException { InternalSearchResponse response = new InternalSearchResponse(); response.readFrom(in); return response; }
public static InternalSearchResponse empty() { return new InternalSearchResponse(InternalSearchHits.empty(), null, null, null, false, null); }
public static InternalSearchResponse empty() { return new InternalSearchResponse(SearchHits.empty(), null, null, null, false, null, 1); }
public static InternalSearchResponse empty() { return new InternalSearchResponse(SearchHits.empty(), null, null, null, false, null, 1); }
public static InternalSearchResponse empty() { return new InternalSearchResponse(SearchHits.empty(), null, null, null, false, null, 1); }
public static InternalSearchResponse fromXContent(final Map<String, Object> map, final AggregationsManifest aggregationsManifest) { final InternalSearchHits searchHits = InternalSearchHitsHelper.fromXContent(map); final InternalFacets facets = InternalFacetsHelper.fromXContent(map); final InternalAggregations aggregations = InternalAggregationsHelper.fromXContent(map, aggregationsManifest); final Suggest suggest = SuggestHelper.fromXContent(map); final boolean timed_out = nodeBooleanValue(map.get("timed_out")); final boolean terminated_early = nodeBooleanValue(map.get("terminated_early"), false); return new InternalSearchResponse( searchHits, facets, aggregations, suggest, timed_out, terminated_early ); } }
public static InternalSearchResponse fromXContent(final Map<String, Object> map, final AggregationsManifest aggregationsManifest) { final InternalSearchHits searchHits = InternalSearchHitsHelper.fromXContent(map); final InternalFacets facets = InternalFacetsHelper.fromXContent(map); final InternalAggregations aggregations = InternalAggregationsHelper.fromXContent(map, aggregationsManifest); final Suggest suggest = SuggestHelper.fromXContent(map); final boolean timed_out = nodeBooleanValue(map.get("timed_out")); final boolean terminated_early = nodeBooleanValue(map.get("terminated_early"), false); return new InternalSearchResponse( searchHits, facets, aggregations, suggest, timed_out, terminated_early ); } }
final SearchProfileShardResults profileResults = in.readOptionalWriteable(SearchProfileShardResults::new); final int numReducePhases = in.getVersion().onOrAfter(Version.V_5_4_0) ? in.readVInt() : 1; final SearchResponseSections internalResponse = new InternalSearchResponse(newHits, aggregations, suggest, profileResults, timedOut, terminatedEarly, numReducePhases); final int totalShards = in.readVInt();
final SearchProfileShardResults profileResults = in.readOptionalWriteable(SearchProfileShardResults::new); final int numReducePhases = in.getVersion().onOrAfter(Version.V_5_4_0) ? in.readVInt() : 1; final SearchResponseSections internalResponse = new InternalSearchResponse(newHits, aggregations, suggest, profileResults, timedOut, terminatedEarly, numReducePhases); final int totalShards = in.readVInt();
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); internalResponse = new InternalSearchResponse(in); totalShards = in.readVInt(); successfulShards = in.readVInt(); int size = in.readVInt(); if (size == 0) { shardFailures = ShardSearchFailure.EMPTY_ARRAY; } else { shardFailures = new ShardSearchFailure[size]; for (int i = 0; i < shardFailures.length; i++) { shardFailures[i] = readShardSearchFailure(in); } } scrollId = in.readOptionalString(); tookInMillis = in.readVLong(); }
public void start() { if (scrollId.getContext().length == 0) { final InternalSearchResponse internalResponse = new InternalSearchResponse(new InternalSearchHits(InternalSearchHits.EMPTY, Long.parseLong(this.scrollId.getAttributes().get("total_hits")), 0.0f), null, null, null, false, null); listener.onResponse(new SearchResponse(internalResponse, request.scrollId(), 0, 0, 0l, buildShardFailures()));
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); internalResponse = new InternalSearchResponse(in); totalShards = in.readVInt(); successfulShards = in.readVInt(); int size = in.readVInt(); if (size == 0) { shardFailures = ShardSearchFailure.EMPTY_ARRAY; } else { shardFailures = new ShardSearchFailure[size]; for (int i = 0; i < shardFailures.length; i++) { shardFailures[i] = readShardSearchFailure(in); } } if (in.getVersion().onOrAfter(Version.V_6_1_0)) { clusters = new Clusters(in); } else { clusters = Clusters.EMPTY; } scrollId = in.readOptionalString(); tookInMillis = in.readVLong(); if (in.getVersion().onOrAfter(Version.V_5_6_0)) { skippedShards = in.readVInt(); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); internalResponse = new InternalSearchResponse(in); totalShards = in.readVInt(); successfulShards = in.readVInt(); int size = in.readVInt(); if (size == 0) { shardFailures = ShardSearchFailure.EMPTY_ARRAY; } else { shardFailures = new ShardSearchFailure[size]; for (int i = 0; i < shardFailures.length; i++) { shardFailures[i] = readShardSearchFailure(in); } } if (in.getVersion().onOrAfter(Version.V_6_1_0)) { clusters = new Clusters(in); } else { clusters = Clusters.EMPTY; } scrollId = in.readOptionalString(); tookInMillis = in.readVLong(); if (in.getVersion().onOrAfter(Version.V_5_6_0)) { skippedShards = in.readVInt(); } }
private SearchResponse handleResponse(final SearchResponse response, final long startTime, final List<SearchResultModifier> modifiers) throws IOException { BytesStreamOutput out = new BytesStreamOutput(); response.writeTo(out); ChannelBufferStreamInput in = new ChannelBufferStreamInput(out.bytes().toChannelBuffer()); Map<String, Object> headers = readHeaders(in); InternalSearchHits hits = modifyHits(modifiers, readHits(in)); InternalAggregations aggregations = readAggregations(in); Suggest suggest = readSuggestions(in); Boolean timedOut = in.readBoolean(); Boolean terminatedEarly = in.readOptionalBoolean(); InternalProfileShardResults profileResults = readInternalProfileShardResults(in); InternalSearchResponse internalResponse = new InternalSearchResponse(hits, aggregations, suggest, profileResults, timedOut, terminatedEarly); SearchResponse newResponse = createNewResponse(startTime, in, internalResponse); copyHeaders(headers, newResponse); logTime(response, startTime); return newResponse; }