Module org.elasticsearch.server
Package org.elasticsearch.action.search
Class SearchContextMissingNodesException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.elasticsearch.ElasticsearchException
org.elasticsearch.action.search.SearchContextMissingNodesException
- All Implemented Interfaces:
Serializable,Writeable,ToXContent,ToXContentFragment
Exception thrown when a search context references nodes that have left the cluster.
This exception indicates that a previously created search context is no longer valid because one or more of the nodes it depends on have left the cluster. This typically occurs when a client tries to fetch additional pages of search results after some nodes have become unavailable. The exception provides details about the missing nodes and the context that is no longer valid.
The exception is returned with HTTP status 404 (NOT_FOUND) when serialized to REST responses.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of search context that became invalid.Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersionThe transport version at which this exception type was introduced.Fields inherited from class org.elasticsearch.ElasticsearchException
REST_EXCEPTION_SKIP_CAUSE, REST_EXCEPTION_SKIP_STACK_TRACE, REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT, STACK_TRACEFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionSearchContextMissingNodesException(SearchContextMissingNodesException.ContextType contextType, Set<String> missingNodeIds) Constructs a new SearchContextMissingNodesException.Constructs a new SearchContextMissingNodesException from a StreamInput. -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of search context that is no longer valid.Returns the set of node IDs that have left the cluster.protected voidmetadataToXContent(XContentBuilder builder, ToXContent.Params params) Serializes the exception metadata to XContent format.status()Returns the HTTP status code for this exception.protected voidwriteTo(StreamOutput out, Writeable.Writer<Throwable> nestedExceptionsWriter) Serializes this exception to a StreamOutput.Methods inherited from class org.elasticsearch.ElasticsearchException
addBodyHeader, addBodyHeader, addHttpHeader, addHttpHeader, addMetadata, addMetadata, failureFromXContent, fromXContent, generateFailureXContent, generateThrowableXContent, generateThrowableXContent, getBodyHeader, getBodyHeaderKeys, getBodyHeaders, getDetailedMessage, getExceptionName, getExceptionName, getHttpHeader, getHttpHeaderKeys, getHttpHeaders, getId, getIndex, getMetadata, getMetadata, getMetadataKeys, getResourceId, getResourceType, getRootCause, getShardId, guessRootCauses, guessRootCauses, innerFromXContent, innerToXContent, isRegistered, isTimeout, readException, readException, readStackTrace, setIndex, setIndex, setResources, setShard, toString, toXContent, toXContent, unwrapCause, writeException, writeStackTraces, writeToMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTraceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
SEARCH_CONTEXT_MISSING_NODES_EXCEPTION_VERSION
The transport version at which this exception type was introduced.
-
-
Constructor Details
-
SearchContextMissingNodesException
public SearchContextMissingNodesException(SearchContextMissingNodesException.ContextType contextType, Set<String> missingNodeIds) Constructs a new SearchContextMissingNodesException.- Parameters:
contextType- the type of search contextmissingNodeIds- the set of node IDs that have left the cluster
-
SearchContextMissingNodesException
Constructs a new SearchContextMissingNodesException from a StreamInput. Used for deserialization during transport communication between nodes.- Parameters:
in- the input stream to read from- Throws:
IOException- if an I/O error occurs while reading from the stream
-
-
Method Details
-
writeTo
protected void writeTo(StreamOutput out, Writeable.Writer<Throwable> nestedExceptionsWriter) throws IOException Serializes this exception to a StreamOutput. Overrides the protected two-arg overload so that custom fields are written both on the directWriteable.writeTopath and on theElasticsearchException.writeExceptionnesting path.- Overrides:
writeToin classElasticsearchException- Throws:
IOException
-
status
Returns the HTTP status code for this exception.- Overrides:
statusin classElasticsearchException- Returns:
RestStatus.NOT_FOUNDto indicate the search context is not found
-
metadataToXContent
protected void metadataToXContent(XContentBuilder builder, ToXContent.Params params) throws IOException Serializes the exception metadata to XContent format. Adds context type and list of missing node IDs to the JSON output.- Overrides:
metadataToXContentin classElasticsearchException- Parameters:
builder- the XContent builder to write toparams- additional parameters for serialization- Throws:
IOException- if an I/O error occurs while writing
-
getMissingNodeIds
Returns the set of node IDs that have left the cluster.- Returns:
- an immutable set of node IDs
-
getContextType
Returns the type of search context that is no longer valid.- Returns:
- the context type
-