java.lang.Object
org.elasticsearch.transport.TransportMessage
org.elasticsearch.transport.TransportResponse
org.elasticsearch.action.ActionResponse
org.elasticsearch.action.search.MultiSearchResponse
- All Implemented Interfaces:
Iterable<MultiSearchResponse.Item>
,Writeable
,ChunkedToXContent
,ChunkedToXContentObject
,RefCounted
public class MultiSearchResponse
extends ActionResponse
implements Iterable<MultiSearchResponse.Item>, ChunkedToXContentObject
A multi search response.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static class
A search response item, holding the actual search response, or an error message if it failed.Nested classes/interfaces inherited from class org.elasticsearch.action.ActionResponse
ActionResponse.Empty
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY
Fields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
decRef()
Note that the lifetime of an outboundTransportMessage
lasts at least until it has been fully sent over the network, and it may be closed on a network thread in a context in which there's a risk of stack overflows if on close it calls back into the network layer in a manner that might end up nesting too deeply.The list of responses, the order is the same as the one provided in the request.getTook()
How long the msearch took.boolean
void
incRef()
iterator()
toString()
Iterator<? extends ToXContent>
toXContentChunked
(ToXContent.Params params) Create an iterator ofToXContent
chunks for a REST response.boolean
void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
toXContentChunkedV7
Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContentObject
isFragment
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.core.RefCounted
mustIncRef
-
Constructor Details
-
MultiSearchResponse
- Throws:
IOException
-
MultiSearchResponse
- Parameters:
items
- individual search responses, the elements in this array are considered as owned by this instance for ref-counting purposes if theirMultiSearchResponse.Item.response
is non-null
-
-
Method Details
-
incRef
public void incRef()- Specified by:
incRef
in interfaceRefCounted
- Overrides:
incRef
in classTransportMessage
-
tryIncRef
public boolean tryIncRef()- Specified by:
tryIncRef
in interfaceRefCounted
- Overrides:
tryIncRef
in classTransportMessage
-
decRef
public boolean decRef()Description copied from class:TransportMessage
Note that the lifetime of an outboundTransportMessage
lasts at least until it has been fully sent over the network, and it may be closed on a network thread in a context in which there's a risk of stack overflows if on close it calls back into the network layer in a manner that might end up nesting too deeply. When in doubt, dispatch any further work onto a separate thread.- Specified by:
decRef
in interfaceRefCounted
- Overrides:
decRef
in classTransportMessage
-
hasReferences
public boolean hasReferences()- Specified by:
hasReferences
in interfaceRefCounted
- Overrides:
hasReferences
in classTransportMessage
-
iterator
- Specified by:
iterator
in interfaceIterable<MultiSearchResponse.Item>
-
getResponses
The list of responses, the order is the same as the one provided in the request. -
getTook
How long the msearch took. -
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContent
Create an iterator ofToXContent
chunks for a REST response. Each chunk is serialized with the sameXContentBuilder
andToXContent.Params
, which is also the same as theToXContent.Params
passed as theparams
argument. For best results, all chunks should beO(1)
size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelper
for some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunked
in interfaceChunkedToXContent
- Returns:
- iterator over chunks of
ToXContent
-
toString
-